Validate arguments have unique names

This commit is contained in:
2020-09-17 10:33:37 +02:00
parent 6e644c5b4b
commit 497b93c41b
6 changed files with 160 additions and 21 deletions

View File

@ -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