summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-09-22 04:42:25 +0200
committerEugen Wissner <belka@caraus.de>2020-09-22 04:42:25 +0200
commite9a94147fb5cf6b871268a373fc211cfa50da2fc (patch)
tree8a0c947ec379c56766656c64b5f840eb7064940a /tests
parent3e393004ae03a717218a805043d9237ca29ac947 (diff)
downloadgraphql-e9a94147fb5cf6b871268a373fc211cfa50da2fc.tar.gz
Validate variables are used
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 dc19d95..b93e2a6 100644
--- a/tests/Language/GraphQL/ValidateSpec.hs
+++ b/tests/Language/GraphQL/ValidateSpec.hs
@@ -492,3 +492,19 @@ spec =
, locations = [AST.Location 9 46]
}
in validate queryString `shouldBe` Seq.singleton expected
+
+ it "rejects unused variables" $
+ let queryString = [r|
+ query variableUnused($atOtherHomes: Boolean) {
+ dog {
+ isHousetrained
+ }
+ }
+ |]
+ expected = Error
+ { message =
+ "Variable \"$atOtherHomes\" is never used in operation \
+ \\"variableUnused\"."
+ , locations = [AST.Location 2 36]
+ }
+ in validate queryString `shouldBe` Seq.singleton expected