summaryrefslogtreecommitdiff
path: root/tests/Test/RootOperationSpec.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-05-23 06:46:21 +0200
committerEugen Wissner <belka@caraus.de>2020-05-23 21:49:57 +0200
commit7cd48217187911855cd2ad473e58d11df0c69d48 (patch)
tree4fe56da3d1c209ea070e75f10aa21cb00eada8f4 /tests/Test/RootOperationSpec.hs
parent26cc53ce0678d48bf7d5550df65171e6bf5288d2 (diff)
downloadgraphql-7cd48217187911855cd2ad473e58d11df0c69d48.tar.gz
Don't fail on invalid fragments and variables
Diffstat (limited to 'tests/Test/RootOperationSpec.hs')
-rw-r--r--tests/Test/RootOperationSpec.hs28
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/Test/RootOperationSpec.hs b/tests/Test/RootOperationSpec.hs
index 08955f3..935b96d 100644
--- a/tests/Test/RootOperationSpec.hs
+++ b/tests/Test/RootOperationSpec.hs
@@ -6,38 +6,36 @@ module Test.RootOperationSpec
import Data.Aeson ((.=), object)
import qualified Data.HashMap.Strict as HashMap
-import Data.List.NonEmpty (NonEmpty(..))
import Language.GraphQL
import qualified Language.GraphQL.Schema as Schema
import Test.Hspec (Spec, describe, it, shouldBe)
import Text.RawString.QQ (r)
import Language.GraphQL.Type.Definition
import Language.GraphQL.Type.Schema
+import qualified Language.GraphQL.Type as Type
hatType :: ObjectType IO
-hatType = ObjectType "Hat"
+hatType = ObjectType "Hat" Nothing
$ HashMap.singleton resolverName
$ Field Nothing (ScalarOutputType int) mempty resolve
where
(Schema.Resolver resolverName resolve) =
- Schema.scalar "circumference" $ pure (60 :: Int)
+ Schema.wrappedObject "circumference" $ pure $ Type.I 60
schema :: Schema IO
schema = Schema
- (ObjectType "Query" hatField)
- (Just $ ObjectType "Mutation" incrementField)
+ (ObjectType "Query" Nothing hatField)
+ (Just $ ObjectType "Mutation" Nothing incrementField)
where
- queryResolvers = Schema.resolversToMap $ garment :| []
- mutationResolvers = Schema.resolversToMap $ increment :| []
- garment = Schema.object "garment" $ pure
- [ Schema.scalar "circumference" $ pure (60 :: Int)
+ garment = NestingResolver
+ $ pure $ Schema.object
+ [ Schema.wrappedObject "circumference" $ pure $ Type.I 60
]
- increment = Schema.scalar "incrementCircumference"
- $ pure (61 :: Int)
- incrementField = Field Nothing (ScalarOutputType int) mempty
- <$> mutationResolvers
- hatField = Field Nothing (ObjectOutputType hatType) mempty
- <$> queryResolvers
+ incrementField = HashMap.singleton "incrementCircumference"
+ $ Field Nothing (ScalarOutputType int) mempty
+ $ NestingResolver $ pure $ Type.I 61
+ hatField = HashMap.singleton "garment"
+ $ Field Nothing (ObjectOutputType hatType) mempty garment
spec :: Spec
spec =