diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-09-19 18:18:26 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-09-19 18:18:26 +0200 |
| commit | 21a7d9cce421352e837945a2334e7ccf10160d8c (patch) | |
| tree | 5fa09a68cd7e5f7ab9aa1db082f74093bcbeb52c /tests | |
| parent | 9a08aa5de73e225a9a76017aee4886ce7f6eccec (diff) | |
| download | graphql-21a7d9cce421352e837945a2334e7ccf10160d8c.tar.gz | |
Validate variable names are unique
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index 507ca7b..1822f57 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -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 |
