summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/GraphQL/ValidateSpec.hs14
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]