diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-08-27 09:04:31 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-08-27 09:04:31 +0200 |
| commit | eebad8a27f164088e356e7936afb9a399c70363a (patch) | |
| tree | 0f9ea3b5bcc7d199de53b0d7c5500875cb4ce46b /tests | |
| parent | e6a6926e18a032a129936794184b518189207648 (diff) | |
| download | graphql-eebad8a27f164088e356e7936afb9a399c70363a.tar.gz | |
Validate operation name uniqueness
Fixes #52.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index 4b5e638..a547e21 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -233,3 +233,25 @@ spec = , path = [] } in validate queryString `shouldBe` Seq.singleton expected + + it "rejects operations with the same name" $ + let queryString = [r| + query dogOperation { + dog { + name + } + } + + mutation dogOperation { + mutateDog { + id + } + } + |] + expected = Error + { message = + "There can be only one operation named \"dogOperation\"." + , locations = [AST.Location 2 15, AST.Location 8 15] + , path = [] + } + in validate queryString `shouldBe` Seq.singleton expected |
