summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2021-05-06 22:23:16 +0200
committerEugen Wissner <belka@caraus.de>2021-05-06 22:23:16 +0200
commit5a5f265fe4bf291c1ef58f5fe452f1e8c69c9ed6 (patch)
tree355fa51dd3e37607afbe536253badc5bed6be5c1 /tests
parent2220f0ca560ba010f0aa1210dad5379f35554f39 (diff)
downloadgraphql-5a5f265fe4bf291c1ef58f5fe452f1e8c69c9ed6.tar.gz
Validate non-nullable values inside lists
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/GraphQL/Validate/RulesSpec.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/Language/GraphQL/Validate/RulesSpec.hs b/tests/Language/GraphQL/Validate/RulesSpec.hs
index 02b14ae..f75aef6 100644
--- a/tests/Language/GraphQL/Validate/RulesSpec.hs
+++ b/tests/Language/GraphQL/Validate/RulesSpec.hs
@@ -847,7 +847,7 @@ spec =
}
in validate queryString `shouldBe` [expected]
- context "providedRequiredArgumentsRule" $
+ context "providedRequiredArgumentsRule" $ do
it "checks for (non-)nullable arguments" $
let queryString = [r|
{
@@ -944,3 +944,19 @@ spec =
, locations = [AST.Location 3 46]
}
in validate queryString `shouldBe` [expected]
+
+ it "checks for required list members" $
+ let queryString = [r|
+ {
+ cat {
+ doesKnowCommands(catCommands: [null])
+ }
+ }
+ |]
+ expected = Error
+ { message =
+ "List of non-null values of type \"CatCommand\" \
+ \cannot contain null values."
+ , locations = [AST.Location 4 54]
+ }
+ in validate queryString `shouldBe` [expected]