From 5a5f265fe4bf291c1ef58f5fe452f1e8c69c9ed6 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 6 May 2021 22:23:16 +0200 Subject: Validate non-nullable values inside lists --- tests/Language/GraphQL/Validate/RulesSpec.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests/Language/GraphQL/Validate') 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] -- cgit v1.2.3