summaryrefslogtreecommitdiff
path: root/tests/Test/FragmentSpec.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-05-13 16:21:48 +0200
committerEugen Wissner <belka@caraus.de>2020-05-13 16:21:48 +0200
commit4c19c88e98bea77ebccc786cd55b30e23ab6e897 (patch)
tree0c4e745ecbed1914852a5dad109687ddf5f9229f /tests/Test/FragmentSpec.hs
parent9232e08eb96ff6613ee6987d746d530bf2b8e6b2 (diff)
downloadgraphql-4c19c88e98bea77ebccc786cd55b30e23ab6e897.tar.gz
Accept resolvers given by the user as is
Diffstat (limited to 'tests/Test/FragmentSpec.hs')
-rw-r--r--tests/Test/FragmentSpec.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/Test/FragmentSpec.hs b/tests/Test/FragmentSpec.hs
index 74293a9..99c0715 100644
--- a/tests/Test/FragmentSpec.hs
+++ b/tests/Test/FragmentSpec.hs
@@ -189,3 +189,27 @@ spec = do
]
actual <- graphql (HashMap.singleton "Query" $ garment "Hat" :| []) query
actual `shouldBe` expected
+
+ it "test1" $ do
+ let query = [r|
+ {
+ garment {
+ circumference
+ }
+ }
+ |]
+ expected = object
+ [ "data" .= object
+ [ "garment" .= object
+ [ "circumference" .= (60 :: Int)
+ ]
+ ]
+ ]
+ actual <- graphql schema query
+ actual `shouldBe` expected
+ where
+ schema = HashMap.singleton "Query" $ garment' :| []
+ garment' = Schema.object "garment" $ return
+ [ circumference'
+ ]
+ circumference' = Schema.scalar "circumference" $ pure (60 :: Int)