summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2023-12-28 09:45:39 +0100
committerEugen Wissner <belka@caraus.de>2023-12-28 09:45:39 +0100
commitb1b6bfcdb902e0cbb97fbe11a59e37676005dee0 (patch)
treeb60aa7fc102b343f846bfa763cc0e2bce39c59e3 /tests
parent59aa010f0bd0e12e60fb9c9de95c92d3bf10c36d (diff)
downloadgraphql-b1b6bfcdb902e0cbb97fbe11a59e37676005dee0.tar.gz
Add a test for the wrong variable location
inside an input object for the role checking for unused and undefined variables.
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/GraphQL/Validate/RulesSpec.hs18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/Language/GraphQL/Validate/RulesSpec.hs b/tests/Language/GraphQL/Validate/RulesSpec.hs
index b0ed59e..0d9faaa 100644
--- a/tests/Language/GraphQL/Validate/RulesSpec.hs
+++ b/tests/Language/GraphQL/Validate/RulesSpec.hs
@@ -538,7 +538,7 @@ spec =
}
in validate queryString `shouldContain` [expected]
- context "noUndefinedVariablesRule" $
+ context "noUndefinedVariablesRule" $ do
it "rejects undefined variables" $
let queryString = [gql|
query variableIsNotDefinedUsedInSingleFragment {
@@ -560,6 +560,20 @@ spec =
}
in validate queryString `shouldBe` [expected]
+ xit "gets location of the variable inside an input object" $
+ let queryString = [gql|
+ query {
+ findDog (complex: { name: $name }) {
+ name
+ }
+ }
+ |]
+ expected = Error
+ { message = "Variable \"$name\" is not defined."
+ , locations = [AST.Location 2 29]
+ }
+ in validate queryString `shouldBe` [expected]
+
context "noUnusedVariablesRule" $ do
it "rejects unused variables" $
let queryString = [gql|
@@ -577,7 +591,7 @@ spec =
}
in validate queryString `shouldBe` [expected]
- xit "detects variables in properties of input objects" $
+ it "detects variables in properties of input objects" $
let queryString = [gql|
query withVar ($name: String!) {
findDog (complex: { name: $name }) {