diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-09-24 05:47:31 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-09-24 05:47:31 +0200 |
| commit | 9bfa2aa7e8a72c9cc08743152a96d18312625712 (patch) | |
| tree | 83455a5432e0430fa6048b13ca2e740cd5017ec4 /tests | |
| parent | e9a94147fb5cf6b871268a373fc211cfa50da2fc (diff) | |
| download | graphql-9bfa2aa7e8a72c9cc08743152a96d18312625712.tar.gz | |
Validate input fields have unique names
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index b93e2a6..75e78d4 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -508,3 +508,16 @@ spec = , locations = [AST.Location 2 36] } in validate queryString `shouldBe` Seq.singleton expected + + it "rejects duplicate fields in input objects" $ + let queryString = [r| + { + findDog(complex: { name: "Fido", name: "Jack" }) + } + |] + expected = Error + { message = + "There can be only one input field named \"name\"." + , locations = [AST.Location 3 36, AST.Location 3 50] + } + in validate queryString `shouldBe` Seq.singleton expected |
