From 856efc5d256449d9282f6547bb5f677d0a7fe482 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 7 Oct 2019 21:03:07 +0200 Subject: Support inline fragments on types --- tests/Test/FragmentSpec.hs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'tests/Test/FragmentSpec.hs') diff --git a/tests/Test/FragmentSpec.hs b/tests/Test/FragmentSpec.hs index 219be4a..189306d 100644 --- a/tests/Test/FragmentSpec.hs +++ b/tests/Test/FragmentSpec.hs @@ -9,7 +9,7 @@ import Data.List.NonEmpty (NonEmpty(..)) import Data.Text (Text) import Language.GraphQL import qualified Language.GraphQL.Schema as Schema -import Test.Hspec (Spec, it, shouldBe, xdescribe) +import Test.Hspec (Spec, describe, it, shouldBe) import Text.RawString.QQ (r) size :: Schema.Resolver IO @@ -37,12 +37,14 @@ inlineQuery = [r|{ }|] spec :: Spec -spec = xdescribe "Inline fragment executor" $ do +spec = describe "Inline fragment executor" $ do it "chooses the first selection if the type matches" $ do actual <- graphql (garment "Hat" :| []) inlineQuery let expected = object - [ "garment" .= object - [ "circumference" .= (60 :: Int) + [ "data" .= object + [ "garment" .= object + [ "circumference" .= (60 :: Int) + ] ] ] in actual `shouldBe` expected @@ -50,8 +52,10 @@ spec = xdescribe "Inline fragment executor" $ do it "chooses the last selection if the type matches" $ do actual <- graphql (garment "Shirt" :| []) inlineQuery let expected = object - [ "garment" .= object - [ "size" .= ("L" :: Text) + [ "data" .= object + [ "garment" .= object + [ "size" .= ("L" :: Text) + ] ] ] in actual `shouldBe` expected -- cgit v1.2.3