summaryrefslogtreecommitdiff
path: root/tests/Language/GraphQL/Execute
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-06-19 10:53:41 +0200
committerEugen Wissner <belka@caraus.de>2020-06-19 10:53:41 +0200
commit91bd2d0d8155469b28749a6458e0f7a9279e3698 (patch)
tree5114e553d2bcdebefe17742c00d1f1777bdb782e /tests/Language/GraphQL/Execute
parent882276a845c33c06b235d9604cbfd5b55d784c7d (diff)
downloadgraphql-91bd2d0d8155469b28749a6458e0f7a9279e3698.tar.gz
Fix list input coercion
Diffstat (limited to 'tests/Language/GraphQL/Execute')
-rw-r--r--tests/Language/GraphQL/Execute/CoerceSpec.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/Language/GraphQL/Execute/CoerceSpec.hs b/tests/Language/GraphQL/Execute/CoerceSpec.hs
index e39d550..339c2e3 100644
--- a/tests/Language/GraphQL/Execute/CoerceSpec.hs
+++ b/tests/Language/GraphQL/Execute/CoerceSpec.hs
@@ -10,7 +10,7 @@ import qualified Data.HashMap.Strict as HashMap
import Data.Maybe (isNothing)
import Data.Scientific (scientific)
import qualified Language.GraphQL.Execute.Coerce as Coerce
-import Language.GraphQL.Type.Definition
+import Language.GraphQL.Type
import qualified Language.GraphQL.Type.In as In
import Prelude hiding (id)
import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy)
@@ -98,7 +98,7 @@ spec = do
expected = Just $ List [String "asdf", String "qwer"]
in actual `shouldBe` expected
- describe "coerceInputLiterals" $ do
+ describe "coerceInputLiteral" $ do
it "coerces enums" $
let expected = Just (Enum "NORTH")
actual = Coerce.coerceInputLiteral
@@ -112,3 +112,11 @@ spec = do
let expected = Just (String "1234")
actual = Coerce.coerceInputLiteral namedIdType (Int 1234)
in actual `shouldBe` expected
+ it "coerces nulls" $ do
+ let actual = Coerce.coerceInputLiteral namedIdType Null
+ in actual `shouldBe` Just Null
+ it "wraps singleton lists" $ do
+ let expected = Just $ List [List [String "1"]]
+ embeddedType = In.ListType $ In.ListType namedIdType
+ actual = Coerce.coerceInputLiteral embeddedType (String "1")
+ in actual `shouldBe` expected