diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-09-18 07:32:58 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-09-18 07:32:58 +0200 |
| commit | 9a08aa5de73e225a9a76017aee4886ce7f6eccec (patch) | |
| tree | 6cdeadc16c994bcb3bd13764c1a7104c2cb56c09 /tests/Language/GraphQL/ValidateSpec.hs | |
| parent | 497b93c41b2534ec2b92b49e93267178417bef56 (diff) | |
| download | graphql-9a08aa5de73e225a9a76017aee4886ce7f6eccec.tar.gz | |
Validate directives are unique per location
Diffstat (limited to 'tests/Language/GraphQL/ValidateSpec.hs')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index dfc3a4d..507ca7b 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -428,3 +428,16 @@ spec = , locations = [AST.Location 4 34, AST.Location 4 54] } in validate queryString `shouldBe` Seq.singleton expected + + it "rejects more than one directive per location" $ do + let queryString = [r| + query ($foo: Boolean = true, $bar: Boolean = false) { + field @skip(if: $foo) @skip(if: $bar) + } + |] + expected = Error + { message = + "There can be only one directive named \"skip\"." + , locations = [AST.Location 3 23, AST.Location 3 39] + } + in validate queryString `shouldBe` Seq.singleton expected |
