summaryrefslogtreecommitdiff
path: root/tests/Language/GraphQL/ValidateSpec.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Language/GraphQL/ValidateSpec.hs')
-rw-r--r--tests/Language/GraphQL/ValidateSpec.hs19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs
index eef5d38..990555e 100644
--- a/tests/Language/GraphQL/ValidateSpec.hs
+++ b/tests/Language/GraphQL/ValidateSpec.hs
@@ -300,7 +300,7 @@ spec =
}
in validate queryString `shouldBe` Seq.singleton expected
- it "rejects the fragment spread without a target" $
+ it "rejects fragment spreads without an unknown target type" $
let queryString = [r|
{
dog {
@@ -319,3 +319,20 @@ spec =
, path = []
}
in validate queryString `shouldBe` Seq.singleton expected
+
+ it "rejects inline fragments without a target" $
+ let queryString = [r|
+ {
+ ... on NotInSchema {
+ name
+ }
+ }
+ |]
+ expected = Error
+ { message =
+ "Inline fragment is specified on type \"NotInSchema\" \
+ \which doesn't exist in the schema."
+ , locations = [AST.Location 3 17]
+ , path = []
+ }
+ in validate queryString `shouldBe` Seq.singleton expected