Validate variable names are unique

This commit is contained in:
2020-09-19 18:18:26 +02:00
parent 9a08aa5de7
commit 21a7d9cce4
9 changed files with 59 additions and 17 deletions

View File

@ -441,3 +441,18 @@ spec =
, locations = [AST.Location 3 23, AST.Location 3 39]
}
in validate queryString `shouldBe` Seq.singleton expected
it "rejects duplicate variables" $
let queryString = [r|
query houseTrainedQuery($atOtherHomes: Boolean, $atOtherHomes: Boolean) {
dog {
isHousetrained(atOtherHomes: $atOtherHomes)
}
}
|]
expected = Error
{ message =
"There can be only one variable named \"atOtherHomes\"."
, locations = [AST.Location 2 39, AST.Location 2 63]
}
in validate queryString `shouldBe` Seq.singleton expected