Skip to content

Commit

Permalink
Replaced static calls on SnapshotExtensions class (#7771)
Browse files Browse the repository at this point in the history
  • Loading branch information
glen-84 authored Nov 27, 2024
1 parent 05bb550 commit c477e13
Show file tree
Hide file tree
Showing 24 changed files with 175 additions and 217 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using CookieCrumble;
using HotChocolate.Tests;
using HotChocolate.Types;
using HotChocolate.Utilities;
Expand Down Expand Up @@ -164,8 +165,7 @@ public async Task UseSet_As_InputType()
.AddQueryType<QuerySet>()
.ExecuteRequestAsync("{ set(set: [\"abc\", \"abc\"]) }");

CookieCrumble.SnapshotExtensions.MatchInlineSnapshot(
result,
result.MatchInlineSnapshot(
"""
{
"data": {
Expand All @@ -186,8 +186,7 @@ public async Task UseHashSet_As_InputType()
.AddQueryType<QuerySet>()
.ExecuteRequestAsync("{ set2(set: [\"abc\", \"abc\"]) }");

CookieCrumble.SnapshotExtensions.MatchInlineSnapshot(
result,
result.MatchInlineSnapshot(
"""
{
"data": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ... on Error {
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -134,7 +134,7 @@ public async Task SimpleMutationReturnList_Inferred_Execute()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -189,7 +189,7 @@ public async Task SimpleMutationExtension_Inferred_Execute()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -212,7 +212,7 @@ public async Task SimpleJsonMutationExtension_Inferred_Execute()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -248,7 +248,7 @@ public async Task Ensure_That_Directive_Middleware_Play_Nice()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -283,7 +283,7 @@ public async Task SimpleMutation_Inferred_Execute()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -339,7 +339,7 @@ ... on CustomError {
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -512,7 +512,7 @@ public async Task Allow_Payload_Result_Field_To_Be_Null()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -543,7 +543,7 @@ public async Task Allow_Id_Middleware()
.SetVariableValues(new Dictionary<string, object?> { { "id", id } })
.Build());

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -567,7 +567,7 @@ public async Task Allow_Id_Middleware2()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -592,7 +592,7 @@ public async Task Allow_InputObject_Middleware()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -615,7 +615,7 @@ public async Task Union_Result_1()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -653,7 +653,7 @@ public async Task Union_Result_2()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -678,7 +678,7 @@ public async Task Union_Result_2_Task()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -702,7 +702,7 @@ public async Task Union_Result_2_Success()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -770,7 +770,7 @@ public async Task Union_Result_3()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -794,7 +794,7 @@ public async Task Union_Result_3_Success()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -832,7 +832,7 @@ public async Task Union_Result_4()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -856,7 +856,7 @@ public async Task Union_Result_4_Success()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -894,7 +894,7 @@ public async Task Union_Result_5()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -917,7 +917,7 @@ public async Task Union_Result_5_Success()
}
}
""");
SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -955,7 +955,7 @@ public async Task Union_Result_6()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -979,7 +979,7 @@ public async Task Union_Result_6_Success()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -1017,7 +1017,7 @@ public async Task Union_Result_7()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -1041,7 +1041,7 @@ public async Task Union_Result_7_Success()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public async Task Payload_Override_With_Errors_Execution_On_Success()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -1117,7 +1117,7 @@ public async Task Payload_Override_With_Errors_Execution_On_Error()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down Expand Up @@ -1170,7 +1170,7 @@ public async Task Mutation_Aggregate_Error_Not_Mapped()
}
""");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,7 @@ public async Task Ensure_Types_Are_Bound_Explicitly()
.ModifyOptions(options => options.DefaultBindingBehavior = BindingBehavior.Explicit)
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

public interface IMockConvention : IConvention
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ public async Task Static_Query_Extensions()
.AddTypeExtension(typeof(StaticExtensions))
.ExecuteRequestAsync("{ hello }");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -620,7 +620,7 @@ public async Task Static_Query_Extensions_Schema()
.AddTypeExtension(typeof(StaticExtensions))
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

[Fact]
Expand All @@ -633,7 +633,7 @@ public async Task Query_Extension_With_Static_Members_Schema()
.AddTypeExtension<QueryExtensionWithStaticField>()
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

[Fact]
Expand All @@ -647,7 +647,7 @@ public async Task Query_Extension_With_Static_Members_2_Schema()
.ModifyOptions(t => t.DefaultFieldBindingFlags = InstanceAndStatic)
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

[Fact]
Expand All @@ -660,7 +660,7 @@ public async Task Query_Extension_With_Static_Members_Execute()
.AddTypeExtension<QueryExtensionWithStaticField>()
.ExecuteRequestAsync("{ hello }");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -673,7 +673,7 @@ public async Task Query_Extension_With_Static_Members_And_Generic_Schema()
.AddTypeExtension(typeof(StaticFooQueryExtensions))
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

[Fact]
Expand All @@ -686,7 +686,7 @@ public async Task Query_Extension_With_Static_Members_And_Generic()
.AddTypeExtension(typeof(StaticFooQueryExtensions))
.ExecuteRequestAsync("{ hello }");

SnapshotExtensions.MatchSnapshot(result);
result.MatchSnapshot();
}

[Fact]
Expand All @@ -699,7 +699,7 @@ public async Task ExtendObjectTypeAttribute_Extends_SchemaType()
.AddTypeExtension<QueryExtensions>()
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

[Fact]
Expand All @@ -713,7 +713,7 @@ public async Task AddObjectTypeExtension1_Extends_SchemaType()
d => d.ExtendsType<QueryType>().Field("foo").Type<IntType>())
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

[Fact]
Expand All @@ -727,7 +727,7 @@ public async Task AddObjectTypeExtension2_Extends_SchemaType()
d => d.Field("foo").Type<IntType>())
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

[Fact]
Expand All @@ -742,7 +742,7 @@ public async Task AddObjectTypeExtension3_Extends_SchemaType()
d => d.Field("foo").Type<IntType>())
.BuildSchemaAsync();

SnapshotExtensions.MatchSnapshot(schema);
schema.MatchSnapshot();
}

public class FooType : ObjectType<Foo>
Expand Down
Loading

0 comments on commit c477e13

Please sign in to comment.