diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-10-02 06:31:38 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-10-02 06:31:38 +0200 |
| commit | 6daae8a5219f62de98b4a65788e436fb1eac8cba (patch) | |
| tree | 2bf515d0e6070ea14ce735b1484fa89c180d4c2c /tests | |
| parent | 56b63f1c3eda70e6de5da4b6395b98a378b1e4e7 (diff) | |
| download | graphql-6daae8a5219f62de98b4a65788e436fb1eac8cba.tar.gz | |
Validate directives are in valid locations
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index b4433ca..6bf0a04 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -606,3 +606,17 @@ spec = , locations = [AST.Location 3 36] } in validate queryString `shouldBe` [expected] + + it "rejects directives in invalid locations" $ + let queryString = [r| + query @skip(if: $foo) { + dog { + name + } + } + |] + expected = Error + { message = "Directive \"@skip\" may not be used on QUERY." + , locations = [AST.Location 2 21] + } + in validate queryString `shouldBe` [expected] |
