summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-10-07 21:03:07 +0200
committerEugen Wissner <belka@caraus.de>2019-10-08 09:03:07 +0200
commit856efc5d256449d9282f6547bb5f677d0a7fe482 (patch)
treed93a11309bc47986aa6aa5ae364d8cb49ef535b4 /tests
parentb2a9ec7d829cde4d49cf6051c12fd64955979f7c (diff)
downloadgraphql-856efc5d256449d9282f6547bb5f677d0a7fe482.tar.gz
Support inline fragments on types
Diffstat (limited to 'tests')
-rw-r--r--tests/Test/FragmentSpec.hs16
1 files changed, 10 insertions, 6 deletions
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