Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated tests from GraphQL-JS regarding unique arguments (#1684)
Co-authored-by: Michael Staib <michael@chillicream.com>
- Loading branch information
1 parent
9a8ef7c
commit 6085a54
Showing
8 changed files
with
315 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/HotChocolate/Core/test/Validation.Tests/Types/CustomDirectiveType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using HotChocolate.Types; | ||
|
||
namespace HotChocolate.Validation.Types | ||
{ | ||
public class CustomDirectiveType | ||
: DirectiveType | ||
{ | ||
private readonly string _name; | ||
|
||
public CustomDirectiveType(string name) | ||
{ | ||
_name = name; | ||
} | ||
|
||
protected override void Configure( | ||
IDirectiveTypeDescriptor descriptor) | ||
{ | ||
descriptor.Repeatable(); | ||
|
||
descriptor.Name(_name); | ||
|
||
descriptor.Location(DirectiveLocation.Field); | ||
|
||
descriptor.Argument("arg") | ||
.Type<StringType>(); | ||
descriptor.Argument("arg1") | ||
.Type<StringType>(); | ||
descriptor.Argument("arg2") | ||
.Type<StringType>(); | ||
descriptor.Argument("arg3") | ||
.Type<StringType>(); | ||
descriptor.Argument("arg4") | ||
.Type<StringType>(); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...st/Validation.Tests/__snapshots__/ArgumentNamesRuleTests.DuplicateDirectiveArguments.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
{ | ||
"Message": "More than one argument with the same name in an argument set is ambiguous and invalid.", | ||
"Code": null, | ||
"Path": [ | ||
"fieldWithArg" | ||
], | ||
"Locations": [ | ||
{ | ||
"Line": 3, | ||
"Column": 60 | ||
} | ||
], | ||
"Exception": null, | ||
"Extensions": { | ||
"directive": "directive", | ||
"argument": "arg1", | ||
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Argument-Uniqueness" | ||
} | ||
} | ||
] |
20 changes: 20 additions & 0 deletions
20
...e/test/Validation.Tests/__snapshots__/ArgumentNamesRuleTests.DuplicateFieldArguments.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"Message": "More than one argument with the same name in an argument set is ambiguous and invalid.", | ||
"Code": null, | ||
"Path": [], | ||
"Locations": [ | ||
{ | ||
"Line": 3, | ||
"Column": 49 | ||
} | ||
], | ||
"Exception": null, | ||
"Extensions": { | ||
"type": "Query", | ||
"field": "fieldWithArg", | ||
"argument": "arg1", | ||
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Argument-Uniqueness" | ||
} | ||
} | ||
] |
40 changes: 40 additions & 0 deletions
40
...alidation.Tests/__snapshots__/ArgumentNamesRuleTests.ManyDuplicateDirectiveArguments.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[ | ||
{ | ||
"Message": "More than one argument with the same name in an argument set is ambiguous and invalid.", | ||
"Code": null, | ||
"Path": [ | ||
"fieldWithArg" | ||
], | ||
"Locations": [ | ||
{ | ||
"Line": 3, | ||
"Column": 60 | ||
} | ||
], | ||
"Exception": null, | ||
"Extensions": { | ||
"directive": "directive", | ||
"argument": "arg1", | ||
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Argument-Uniqueness" | ||
} | ||
}, | ||
{ | ||
"Message": "More than one argument with the same name in an argument set is ambiguous and invalid.", | ||
"Code": null, | ||
"Path": [ | ||
"fieldWithArg" | ||
], | ||
"Locations": [ | ||
{ | ||
"Line": 3, | ||
"Column": 75 | ||
} | ||
], | ||
"Exception": null, | ||
"Extensions": { | ||
"directive": "directive", | ||
"argument": "arg1", | ||
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Argument-Uniqueness" | ||
} | ||
} | ||
] |
38 changes: 38 additions & 0 deletions
38
...st/Validation.Tests/__snapshots__/ArgumentNamesRuleTests.ManyDuplicateFieldArguments.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"Message": "More than one argument with the same name in an argument set is ambiguous and invalid.", | ||
"Code": null, | ||
"Path": [], | ||
"Locations": [ | ||
{ | ||
"Line": 3, | ||
"Column": 49 | ||
} | ||
], | ||
"Exception": null, | ||
"Extensions": { | ||
"type": "Query", | ||
"field": "fieldWithArg", | ||
"argument": "arg1", | ||
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Argument-Uniqueness" | ||
} | ||
}, | ||
{ | ||
"Message": "More than one argument with the same name in an argument set is ambiguous and invalid.", | ||
"Code": null, | ||
"Path": [], | ||
"Locations": [ | ||
{ | ||
"Line": 3, | ||
"Column": 64 | ||
} | ||
], | ||
"Exception": null, | ||
"Extensions": { | ||
"type": "Query", | ||
"field": "fieldWithArg", | ||
"argument": "arg1", | ||
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Argument-Uniqueness" | ||
} | ||
} | ||
] |