From 497b93c41b2534ec2b92b49e93267178417bef56 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 17 Sep 2020 10:33:37 +0200 Subject: Validate arguments have unique names --- tests/Language/GraphQL/ValidateSpec.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/Language/GraphQL') diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index 53f63aa..dfc3a4d 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -413,3 +413,18 @@ spec = , locations = [AST.Location 7 15] } in validate queryString `shouldBe` Seq.fromList [error1, error2] + + it "rejects duplicate field arguments" $ do + let queryString = [r| + { + dog { + isHousetrained(atOtherHomes: true, atOtherHomes: true) + } + } + |] + expected = Error + { message = + "There can be only one argument named \"atOtherHomes\"." + , locations = [AST.Location 4 34, AST.Location 4 54] + } + in validate queryString `shouldBe` Seq.singleton expected -- cgit v1.2.3