summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-09-20 06:59:27 +0200
committerEugen Wissner <belka@caraus.de>2020-09-20 06:59:27 +0200
commit38c3097bcf2d3c92a180c5d328cfb15ef80f0b95 (patch)
treeed64b67bff6d276dbb532f2da403eee2a5209d11 /tests
parent21a7d9cce421352e837945a2334e7ccf10160d8c (diff)
downloadgraphql-38c3097bcf2d3c92a180c5d328cfb15ef80f0b95.tar.gz
Validate fragments are input types
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/GraphQL/ValidateSpec.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs
index 1822f57..340104d 100644
--- a/tests/Language/GraphQL/ValidateSpec.hs
+++ b/tests/Language/GraphQL/ValidateSpec.hs
@@ -456,3 +456,18 @@ spec =
, locations = [AST.Location 2 39, AST.Location 2 63]
}
in validate queryString `shouldBe` Seq.singleton expected
+
+ it "rejects non-input types as variables" $
+ let queryString = [r|
+ query takesDogBang($dog: Dog!) {
+ dog {
+ isHousetrained(atOtherHomes: $dog)
+ }
+ }
+ |]
+ expected = Error
+ { message =
+ "Variable \"$dog\" cannot be non-input type \"Dog\"."
+ , locations = [AST.Location 2 34]
+ }
+ in validate queryString `shouldBe` Seq.singleton expected