summaryrefslogtreecommitdiff
path: root/tests/Language/GraphQL/RootOperationSpec.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Language/GraphQL/RootOperationSpec.hs')
-rw-r--r--tests/Language/GraphQL/RootOperationSpec.hs31
1 files changed, 16 insertions, 15 deletions
diff --git a/tests/Language/GraphQL/RootOperationSpec.hs b/tests/Language/GraphQL/RootOperationSpec.hs
index 4c54b40..e7fbcd7 100644
--- a/tests/Language/GraphQL/RootOperationSpec.hs
+++ b/tests/Language/GraphQL/RootOperationSpec.hs
@@ -4,18 +4,21 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE PackageImports #-}
+
module Language.GraphQL.RootOperationSpec
( spec
) where
-import Data.Aeson ((.=), object)
+import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HashMap
-import Language.GraphQL.Foundation
+import Language.GraphQL
+import Language.GraphQL.AST (Name)
import Test.Hspec (Spec, describe, it)
import Language.GraphQL.TH
import Language.GraphQL.Type
import qualified Language.GraphQL.Type.Out as Out
-import Test.Hspec.GraphQL
+import "graphql-spice" Test.Hspec.GraphQL
hatType :: Out.ObjectType IO
hatType = Out.ObjectType "Hat" Nothing []
@@ -49,13 +52,12 @@ spec =
}
}
|]
- expected = HashMap.singleton "data"
- $ object
- [ "garment" .= object
- [ "circumference" .= (60 :: Int)
- ]
- ]
- actual <- graphql garmentSchema querySource
+ expected = Object
+ $ HashMap.singleton "garment"
+ $ Object
+ $ HashMap.singleton "circumference"
+ $ Int 60
+ actual <- graphql garmentSchema Nothing (mempty :: HashMap Name Value) querySource
actual `shouldResolveTo` expected
it "chooses Mutation" $ do
@@ -64,9 +66,8 @@ spec =
incrementCircumference
}
|]
- expected = HashMap.singleton "data"
- $ object
- [ "incrementCircumference" .= (61 :: Int)
- ]
- actual <- graphql garmentSchema querySource
+ expected = Object
+ $ HashMap.singleton "incrementCircumference"
+ $ Int 61
+ actual <- graphql garmentSchema Nothing (mempty :: HashMap Name Value) querySource
actual `shouldResolveTo` expected