From b8088735db4a06b4d9b434579692e4580839df43 Mon Sep 17 00:00:00 2001 From: AntonC9018 Date: Wed, 13 Dec 2023 11:25:38 +0200 Subject: [PATCH] Ignore last argument of key directive --- .../ApolloFederation.Tests/Directives/KeyDirectiveTests.cs | 4 ++-- .../Directives/ProvidesDirectiveTests.cs | 2 +- .../Directives/RequiresDirectiveTests.cs | 2 +- .../test/ApolloFederation.Tests/FederationTypesTestBase.cs | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.cs index f32d1a37442..310cbf5ed20 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.cs @@ -26,8 +26,8 @@ public void AddKeyDirective_EnsureAvailableInSchema() Assert.NotNull(directive); Assert.IsType(directive); Assert.Equal(WellKnownTypeNames.Key, directive!.Name); - Assert.Single(directive.Arguments); - AssertDirectiveHasFieldsArgument(directive); + Assert.Equal(2, directive.Arguments.Count); + AssertDirectiveHasFieldsArgument(directive.Arguments.Take(1)); Assert.True(directive.Locations.HasFlag(DirectiveLocation.Object)); Assert.True(directive.Locations.HasFlag(DirectiveLocation.Interface)); } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.cs index 5e38f963f45..7c6fc133621 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.cs @@ -24,7 +24,7 @@ public void AddProvidesDirective_EnsureAvailableInSchema() Assert.IsType(directive); Assert.Equal(WellKnownTypeNames.Provides, directive!.Name); Assert.Single(directive.Arguments); - AssertDirectiveHasFieldsArgument(directive); + AssertDirectiveHasFieldsArgument(directive.Arguments); Assert.Equal(DirectiveLocation.FieldDefinition, directive.Locations); } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.cs index 33614a89332..b47a5cd3fc0 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.cs @@ -24,7 +24,7 @@ public void AddRequiresDirective_EnsureAvailableInSchema() Assert.IsType(directive); Assert.Equal(WellKnownTypeNames.Requires, directive!.Name); Assert.Single(directive.Arguments); - AssertDirectiveHasFieldsArgument(directive); + AssertDirectiveHasFieldsArgument(directive.Arguments); Assert.Equal(DirectiveLocation.FieldDefinition, directive.Locations); } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs index 39733fb7cd3..353b4baaede 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using HotChocolate.Types; namespace HotChocolate.ApolloFederation; @@ -21,10 +22,10 @@ protected ISchema CreateSchema(Action configure) return builder.Create(); } - protected void AssertDirectiveHasFieldsArgument(DirectiveType directive) + protected void AssertDirectiveHasFieldsArgument(IEnumerable directiveArguments) { Assert.Collection( - directive.Arguments, + directiveArguments, t => { Assert.Equal("fields", t.Name);