summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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