Support nested fragments

... without forward lookup.
This commit is contained in:
2019-11-09 23:24:31 +01:00
parent b77da3d492
commit 1dd6b7b013
3 changed files with 45 additions and 24 deletions

View File

@ -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