summaryrefslogtreecommitdiff
path: root/tests/Test/StarWars/QueryTests.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-07-08 10:15:47 +0200
committerEugen Wissner <belka@caraus.de>2019-07-08 10:15:47 +0200
commit61879fb12437302d6b14e0e0297e3a8742d91f8b (patch)
tree32915a3da74f1b41b113f9a0fa12033e3cc6f656 /tests/Test/StarWars/QueryTests.hs
parent22d4a4e583d8075fc71cddc22566f41fc5a698dc (diff)
downloadgraphql-61879fb12437302d6b14e0e0297e3a8742d91f8b.tar.gz
Constrain the resolvers with MonadIO
This replaces the most usages of MonadPlus, which is not appropriate for the resolvers, since a resolver is unambiguously chosen by the name (no need for 'mplus'), and the resolvers are often doing IO.
Diffstat (limited to 'tests/Test/StarWars/QueryTests.hs')
-rw-r--r--tests/Test/StarWars/QueryTests.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/Test/StarWars/QueryTests.hs b/tests/Test/StarWars/QueryTests.hs
index 27e66ea..3a6ca75 100644
--- a/tests/Test/StarWars/QueryTests.hs
+++ b/tests/Test/StarWars/QueryTests.hs
@@ -11,7 +11,10 @@ import Language.GraphQL
import Language.GraphQL.Schema (Subs)
import Text.RawString.QQ (r)
import Test.Tasty (TestTree, testGroup)
-import Test.Tasty.HUnit (Assertion, testCase, (@?=))
+import Test.Tasty.HUnit ( Assertion
+ , testCase
+ , (@?=)
+ )
import Test.StarWars.Schema
-- * Test
@@ -344,13 +347,7 @@ test = testGroup "Star Wars Query Tests"
alderaan = "homePlanet" .= ("Alderaan" :: Text)
testQuery :: Text -> Aeson.Value -> Assertion
-testQuery q expected = graphql schema q @?= Just expected
-
--- testFail :: Text -> Assertion
--- testFail q = graphql schema q @?= Nothing
+testQuery q expected = graphql schema q >>= (@?= expected)
testQueryParams :: Subs -> Text -> Aeson.Value -> Assertion
-testQueryParams f q expected = graphqlSubs schema f q @?= Just expected
-
--- testFailParams :: Subs -> Text -> Assertion
--- testFailParams f q = graphqlSubs schema f q @?= Nothing
+testQueryParams f q expected = graphqlSubs schema f q >>= (@?= expected)