summaryrefslogtreecommitdiff
path: root/tests/Language
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2021-06-17 08:15:27 +0200
committerEugen Wissner <belka@caraus.de>2021-06-17 08:15:27 +0200
commit2ce2be5d917091872b45b650b60ac2a23f544916 (patch)
tree0b4b3dbceb74cb810522dff5fee923fcc92d8a78 /tests/Language
parentc311cb0070de2979111014e8e22a5f6fefee3ea3 (diff)
downloadgraphql-2ce2be5d917091872b45b650b60ac2a23f544916.tar.gz
Provide location information for interface errors
Diffstat (limited to 'tests/Language')
-rw-r--r--tests/Language/GraphQL/ExecuteSpec.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/Language/GraphQL/ExecuteSpec.hs b/tests/Language/GraphQL/ExecuteSpec.hs
index f5bfd33..815e315 100644
--- a/tests/Language/GraphQL/ExecuteSpec.hs
+++ b/tests/Language/GraphQL/ExecuteSpec.hs
@@ -218,7 +218,7 @@ spec =
$ parse document "" "{ philosopher { school } }"
in actual `shouldBe` expected
- it "gives location information for invalid interfaces" $
+ it "gives location information for non-null unions" $
let data'' = Aeson.object
[ "philosopher" .= Aeson.object
[ "interest" .= Aeson.Null
@@ -234,6 +234,22 @@ spec =
$ parse document "" "{ philosopher { interest } }"
in actual `shouldBe` expected
+ it "gives location information for invalid interfaces" $
+ let data'' = Aeson.object
+ [ "philosopher" .= Aeson.object
+ [ "majorWork" .= Aeson.Null
+ ]
+ ]
+ executionErrors = pure $ Error
+ { message = "Interface value completion failed."
+ , locations = [Location 1 17]
+ , path = []
+ }
+ expected = Response data'' executionErrors
+ Right (Right actual) = either (pure . parseError) execute'
+ $ parse document "" "{ philosopher { majorWork { title } } }"
+ in actual `shouldBe` expected
+
context "Subscription" $
it "subscribes" $
let data'' = Aeson.object