diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-09-22 04:42:25 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-09-22 04:42:25 +0200 |
| commit | e9a94147fb5cf6b871268a373fc211cfa50da2fc (patch) | |
| tree | 8a0c947ec379c56766656c64b5f840eb7064940a /tests | |
| parent | 3e393004ae03a717218a805043d9237ca29ac947 (diff) | |
| download | graphql-e9a94147fb5cf6b871268a373fc211cfa50da2fc.tar.gz | |
Validate variables are used
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 16 |
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 |
