From 38c3097bcf2d3c92a180c5d328cfb15ef80f0b95 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 20 Sep 2020 06:59:27 +0200 Subject: Validate fragments are input types --- tests/Language/GraphQL/ValidateSpec.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/Language/GraphQL/ValidateSpec.hs') 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 -- cgit v1.2.3