summaryrefslogtreecommitdiff
path: root/tests/Test/StarWars
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-09-28 07:06:15 +0200
committerEugen Wissner <belka@caraus.de>2020-09-28 07:06:15 +0200
commit4602eb1df3a713989b155f0140ff8909eb0370cf (patch)
tree6c82cab7436516ba79e2c13454e9f47ecd2ec4b4 /tests/Test/StarWars
parentced9b815db516ac4196856c535eedca85f4a1935 (diff)
downloadgraphql-4602eb1df3a713989b155f0140ff8909eb0370cf.tar.gz
Validate arguments are defined
Diffstat (limited to 'tests/Test/StarWars')
-rw-r--r--tests/Test/StarWars/QuerySpec.hs4
-rw-r--r--tests/Test/StarWars/Schema.hs10
2 files changed, 5 insertions, 9 deletions
diff --git a/tests/Test/StarWars/QuerySpec.hs b/tests/Test/StarWars/QuerySpec.hs
index 8d744ab..f9b13d9 100644
--- a/tests/Test/StarWars/QuerySpec.hs
+++ b/tests/Test/StarWars/QuerySpec.hs
@@ -357,10 +357,10 @@ spec = describe "Star Wars Query Tests" $ do
testQuery :: Text -> Aeson.Value -> Expectation
testQuery q expected =
- let Right (Right actual) = graphql schema q
+ let Right (Right actual) = graphql starWarsSchema q
in Aeson.Object actual `shouldBe` expected
testQueryParams :: Aeson.Object -> Text -> Aeson.Value -> Expectation
testQueryParams f q expected =
- let Right (Right actual) = graphqlSubs schema Nothing f q
+ let Right (Right actual) = graphqlSubs starWarsSchema Nothing f q
in Aeson.Object actual `shouldBe` expected
diff --git a/tests/Test/StarWars/Schema.hs b/tests/Test/StarWars/Schema.hs
index 34a6a35..706d9b3 100644
--- a/tests/Test/StarWars/Schema.hs
+++ b/tests/Test/StarWars/Schema.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Test.StarWars.Schema
- ( schema
+ ( starWarsSchema
) where
import Control.Monad.Catch (MonadThrow(..), SomeException)
@@ -17,12 +17,8 @@ import Prelude hiding (id)
-- See https://github.com/graphql/graphql-js/blob/master/src/__tests__/starWarsSchema.js
-schema :: Schema (Either SomeException)
-schema = Schema
- { query = queryType
- , mutation = Nothing
- , subscription = Nothing
- }
+starWarsSchema :: Schema (Either SomeException)
+starWarsSchema = schema queryType
where
queryType = Out.ObjectType "Query" Nothing [] $ HashMap.fromList
[ ("hero", heroFieldResolver)