From a2f64ad7ad1868d68cfcca98c5e0745acf92494f Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Mon, 12 Dec 2022 21:22:01 +0100 Subject: [PATCH] Fixed Tests --- ...sts.ExecutionDepthShouldNotLeadToEmptyObjects.snap | 4 ++-- .../__snapshots__/SchemaTests.SchemaSnapshot.graphql | 10 ++++++++++ .../ReadOnlySchemaOptionsTests.Copy_Options.snap | 1 - ...dOnlySchemaOptionsTests.Copy_Options_Defaults.snap | 1 - ...ions_EnableOneOf_EnableDirectiveIntrospection.snap | 1 - .../Core/test/Validation.Tests/ValidationUtils.cs | 11 +++++++---- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/StarWarsCodeFirst/__snapshots__/StarWarsCodeFirstTests.ExecutionDepthShouldNotLeadToEmptyObjects.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/StarWarsCodeFirst/__snapshots__/StarWarsCodeFirstTests.ExecutionDepthShouldNotLeadToEmptyObjects.snap index b780026ea72..eedae305458 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/StarWarsCodeFirst/__snapshots__/StarWarsCodeFirstTests.ExecutionDepthShouldNotLeadToEmptyObjects.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/StarWarsCodeFirst/__snapshots__/StarWarsCodeFirstTests.ExecutionDepthShouldNotLeadToEmptyObjects.snap @@ -4,8 +4,8 @@ "message": "The GraphQL document has an execution depth of 6 which exceeds the max allowed execution depth of 3.", "locations": [ { - "line": 2, - "column": 17 + "line": 1, + "column": 1 } ], "extensions": { diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/SchemaTests.SchemaSnapshot.graphql b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/SchemaTests.SchemaSnapshot.graphql index 033efae497f..3a50d2ba70a 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/SchemaTests.SchemaSnapshot.graphql +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/SchemaTests.SchemaSnapshot.graphql @@ -1,11 +1,17 @@ schema { query: Query + mutation: Mutation + subscription: Subscription } interface Entity { name: String! } +type Mutation { + doSomething: String! +} + type Person implements Entity { name: String! address: String! @@ -23,6 +29,10 @@ type SomeBook { title: String } +type Subscription { + onSomething: String! +} + enum CustomEnum { ABC DEF diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options.snap b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options.snap index df8d5a0ddae..4d78930fd4f 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options.snap @@ -13,7 +13,6 @@ "FieldMiddleware": "AllFields", "EnableDirectiveIntrospection": false, "DefaultDirectiveVisibility": "Public", - "AllowInlining": true, "DefaultResolverStrategy": "Parallel", "ValidatePipelineOrder": true, "StrictRuntimeTypeValidation": false, diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_Defaults.snap b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_Defaults.snap index 26efc772460..f3bc298d459 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_Defaults.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_Defaults.snap @@ -13,7 +13,6 @@ "FieldMiddleware": "UserDefinedFields", "EnableDirectiveIntrospection": false, "DefaultDirectiveVisibility": "Public", - "AllowInlining": true, "DefaultResolverStrategy": "Parallel", "ValidatePipelineOrder": true, "StrictRuntimeTypeValidation": false, diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_EnableOneOf_EnableDirectiveIntrospection.snap b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_EnableOneOf_EnableDirectiveIntrospection.snap index 842ec87c97c..2737239fa85 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_EnableOneOf_EnableDirectiveIntrospection.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/ReadOnlySchemaOptionsTests.Copy_Options_EnableOneOf_EnableDirectiveIntrospection.snap @@ -13,7 +13,6 @@ "FieldMiddleware": "AllFields", "EnableDirectiveIntrospection": true, "DefaultDirectiveVisibility": "Public", - "AllowInlining": true, "DefaultResolverStrategy": "Parallel", "ValidatePipelineOrder": true, "StrictRuntimeTypeValidation": false, diff --git a/src/HotChocolate/Core/test/Validation.Tests/ValidationUtils.cs b/src/HotChocolate/Core/test/Validation.Tests/ValidationUtils.cs index 36be91253cb..0803a202cbb 100644 --- a/src/HotChocolate/Core/test/Validation.Tests/ValidationUtils.cs +++ b/src/HotChocolate/Core/test/Validation.Tests/ValidationUtils.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using HotChocolate.Language; using HotChocolate.Types; using HotChocolate.Validation.Types; @@ -11,9 +12,11 @@ namespace HotChocolate.Validation; public static class ValidationUtils { public static DocumentValidatorContext CreateContext(ISchema? schema = null) - { - return new() { Schema = schema ?? CreateSchema() }; - } + => new() + { + Schema = schema ?? CreateSchema(), + ContextData = new Dictionary() + }; public static void Prepare(this IDocumentValidatorContext context, DocumentNode document) { @@ -87,4 +90,4 @@ public static ISchema CreateSchema() x => x.Repeatable()) .ModifyOptions(o => o.EnableOneOf = true) .Create(); -} \ No newline at end of file +}