summaryrefslogtreecommitdiff
path: root/tests/Test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Test')
-rw-r--r--tests/Test/FragmentSpec.hs18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/Test/FragmentSpec.hs b/tests/Test/FragmentSpec.hs
index 337db7e..7b2bb92 100644
--- a/tests/Test/FragmentSpec.hs
+++ b/tests/Test/FragmentSpec.hs
@@ -4,12 +4,13 @@ module Test.FragmentSpec
( spec
) where
-import Data.Aeson (object, (.=))
+import Data.Aeson (Value(..), object, (.=))
+import qualified Data.HashMap.Strict as HashMap
import Data.List.NonEmpty (NonEmpty(..))
import Data.Text (Text)
import Language.GraphQL
import qualified Language.GraphQL.Schema as Schema
-import Test.Hspec (Spec, describe, it, shouldBe)
+import Test.Hspec (Spec, describe, it, shouldBe, shouldNotSatisfy)
import Text.RawString.QQ (r)
size :: Schema.Resolver IO
@@ -81,3 +82,16 @@ spec = describe "Inline fragment executor" $ do
]
]
in actual `shouldBe` expected
+
+ it "evaluates fragments on Query" $ do
+ let query = [r|{
+ ... {
+ size
+ }
+ }|]
+
+ actual <- graphql (size :| []) query
+ actual `shouldNotSatisfy` hasErrors
+ where
+ hasErrors (Object object') = HashMap.member "errors" object'
+ hasErrors _ = True