From 4c19c88e98bea77ebccc786cd55b30e23ab6e897 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 13 May 2020 16:21:48 +0200 Subject: Accept resolvers given by the user as is --- tests/Test/FragmentSpec.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/Test/FragmentSpec.hs') 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) -- cgit v1.2.3