diff options
Diffstat (limited to 'tests/Language/GraphQL/ValidateSpec.hs')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index 60e717a..92b3001 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -594,7 +594,7 @@ spec = it "rejects undefined input object fields" $ let queryString = [r| { - findDog(complex: { favoriteCookieFlavor: "Bacon" }) { + findDog(complex: { favoriteCookieFlavor: "Bacon", name: "Jack" }) { name } } @@ -620,3 +620,19 @@ spec = , locations = [AST.Location 2 21] } in validate queryString `shouldBe` [expected] + + it "rejects missing required input fields" $ + let queryString = [r| + { + findDog(complex: { name: null }) { + name + } + } + |] + expected = Error + { message = + "Input field \"name\" of type \"DogData\" is required, \ + \but it was not provided." + , locations = [AST.Location 3 34] + } + in validate queryString `shouldBe` [expected] |
