summaryrefslogtreecommitdiff
path: root/tests/Test/FragmentSpec.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-11-09 23:24:31 +0100
committerEugen Wissner <belka@caraus.de>2019-11-09 23:24:31 +0100
commit1dd6b7b013dfe2092859ddc3850944a9925a45dd (patch)
treebd233e831087ad7d09db05f70d5711515a4f1cab /tests/Test/FragmentSpec.hs
parentb77da3d4928797962c8a61d08337c266c00fa77d (diff)
downloadgraphql-1dd6b7b013dfe2092859ddc3850944a9925a45dd.tar.gz
Support nested fragments
... without forward lookup.
Diffstat (limited to 'tests/Test/FragmentSpec.hs')
-rw-r--r--tests/Test/FragmentSpec.hs30
1 files changed, 26 insertions, 4 deletions
diff --git a/tests/Test/FragmentSpec.hs b/tests/Test/FragmentSpec.hs
index 7b2bb92..6a49eb6 100644
--- a/tests/Test/FragmentSpec.hs
+++ b/tests/Test/FragmentSpec.hs
@@ -91,7 +91,29 @@ spec = describe "Inline fragment executor" $ do
}|]
actual <- graphql (size :| []) query
- actual `shouldNotSatisfy` hasErrors
- where
- hasErrors (Object object') = HashMap.member "errors" object'
- hasErrors _ = True
+ let hasErrors (Object object') = HashMap.member "errors" object'
+ hasErrors _ = True
+ in actual `shouldNotSatisfy` hasErrors
+
+ it "evaluates nested fragments" $ do
+ let query = [r|
+ {
+ ...hatFragment
+ }
+
+ fragment hatFragment on Hat {
+ ...circumferenceFragment
+ }
+
+ fragment circumferenceFragment on Hat {
+ circumference
+ }
+ |]
+
+ actual <- graphql (circumference :| []) query
+ let expected = object
+ [ "data" .= object
+ [ "circumference" .= (60 :: Int)
+ ]
+ ]
+ in actual `shouldBe` expected