Skip to content

Commit

Permalink
Ignore last argument of key directive
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonC9018 committed Dec 13, 2023
1 parent 4d10e95 commit b808873
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public void AddKeyDirective_EnsureAvailableInSchema()
Assert.NotNull(directive);
Assert.IsType<KeyDirectiveType>(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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void AddProvidesDirective_EnsureAvailableInSchema()
Assert.IsType<ProvidesDirectiveType>(directive);
Assert.Equal(WellKnownTypeNames.Provides, directive!.Name);
Assert.Single(directive.Arguments);
AssertDirectiveHasFieldsArgument(directive);
AssertDirectiveHasFieldsArgument(directive.Arguments);
Assert.Equal(DirectiveLocation.FieldDefinition, directive.Locations);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void AddRequiresDirective_EnsureAvailableInSchema()
Assert.IsType<RequiresDirectiveType>(directive);
Assert.Equal(WellKnownTypeNames.Requires, directive!.Name);
Assert.Single(directive.Arguments);
AssertDirectiveHasFieldsArgument(directive);
AssertDirectiveHasFieldsArgument(directive.Arguments);
Assert.Equal(DirectiveLocation.FieldDefinition, directive.Locations);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using HotChocolate.Types;

namespace HotChocolate.ApolloFederation;
Expand All @@ -21,10 +22,10 @@ protected ISchema CreateSchema(Action<ISchemaBuilder> configure)
return builder.Create();
}

protected void AssertDirectiveHasFieldsArgument(DirectiveType directive)
protected void AssertDirectiveHasFieldsArgument(IEnumerable<DirectiveArgument> directiveArguments)
{
Assert.Collection(
directive.Arguments,
directiveArguments,
t =>
{
Assert.Equal("fields", t.Name);
Expand Down

0 comments on commit b808873

Please sign in to comment.