From 9a08aa5de73e225a9a76017aee4886ce7f6eccec Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 18 Sep 2020 07:32:58 +0200 Subject: Validate directives are unique per location --- tests/Language/GraphQL/ValidateSpec.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/Language/GraphQL/ValidateSpec.hs') 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 -- cgit v1.2.3