From 61879fb12437302d6b14e0e0297e3a8742d91f8b Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 8 Jul 2019 10:15:47 +0200 Subject: 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. --- tests/Test/StarWars/QueryTests.hs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'tests/Test/StarWars/QueryTests.hs') 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) -- cgit v1.2.3