summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-08-31 11:06:27 +0200
committerEugen Wissner <belka@caraus.de>2020-08-31 11:06:27 +0200
commit33318a3b01d27771c6d51ddc5899162bf3acebd8 (patch)
treedbd7c8f6f37b56deed4d21398e03f81c254f4750 /tests
parent4b59da2fcb3d719855060143e5f71fb710031f75 (diff)
downloadgraphql-33318a3b01d27771c6d51ddc5899162bf3acebd8.tar.gz
Validate fragment spread target existence
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/GraphQL/ValidateSpec.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs
index 8f6626b..f8809f9 100644
--- a/tests/Language/GraphQL/ValidateSpec.hs
+++ b/tests/Language/GraphQL/ValidateSpec.hs
@@ -281,3 +281,19 @@ spec =
, path = []
}
in validate queryString `shouldBe` Seq.singleton expected
+
+ it "rejects the fragment spread without a target" $
+ let queryString = [r|
+ {
+ dog {
+ ...undefinedFragment
+ }
+ }
+ |]
+ expected = Error
+ { message =
+ "Fragment target \"undefinedFragment\" is undefined."
+ , locations = [AST.Location 4 19]
+ , path = []
+ }
+ in validate queryString `shouldBe` Seq.singleton expected