diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-08-26 18:58:48 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-08-26 18:58:48 +0200 |
| commit | e6a6926e18a032a129936794184b518189207648 (patch) | |
| tree | 374923eca07e95edd41dd2811cfb5924c33c9fe2 /tests | |
| parent | 73555332681a3702db5e277f21a53c628c3a524f (diff) | |
| download | graphql-e6a6926e18a032a129936794184b518189207648.tar.gz | |
Validate anonymous operation definitions
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index c463dd9..4b5e638 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -209,3 +209,27 @@ spec = , path = [] } in validate queryString `shouldBe` Seq.singleton expected + + it "rejects multiple anonymous operations" $ + let queryString = [r| + { + dog { + name + } + } + + query getName { + dog { + owner { + name + } + } + } + |] + expected = Error + { message = + "This anonymous operation must be the only defined operation." + , locations = [AST.Location 2 15] + , path = [] + } + in validate queryString `shouldBe` Seq.singleton expected |
