summaryrefslogtreecommitdiff
path: root/src/Test
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2023-02-26 09:43:43 +0100
committerEugen Wissner <belka@caraus.de>2023-02-26 09:43:43 +0100
commit2834360411d41f8d7cb22d914d5cb914d928d51f (patch)
tree00f47e28747e3fa8f32f1582a29f12922f8fdac9 /src/Test
parent83f2dc1a2d4820a9d58618ff4d3724db420fe3b6 (diff)
downloadgraphql-2834360411d41f8d7cb22d914d5cb914d928d51f.tar.gz
Remove JSON support in the core package
Diffstat (limited to 'src/Test')
-rw-r--r--src/Test/Hspec/GraphQL.hs49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/Test/Hspec/GraphQL.hs b/src/Test/Hspec/GraphQL.hs
deleted file mode 100644
index a848c15..0000000
--- a/src/Test/Hspec/GraphQL.hs
+++ /dev/null
@@ -1,49 +0,0 @@
-{- This Source Code Form is subject to the terms of the Mozilla Public License,
- v. 2.0. If a copy of the MPL was not distributed with this file, You can
- obtain one at https://mozilla.org/MPL/2.0/. -}
-
-{-# LANGUAGE CPP #-}
-
-#ifdef WITH_JSON
-{-# LANGUAGE ExplicitForAll #-}
-{-# LANGUAGE OverloadedStrings #-}
-
--- | Test helpers.
-module Test.Hspec.GraphQL {-# DEPRECATED "Use graphql-spice package instead" #-}
- ( shouldResolve
- , shouldResolveTo
- ) where
-
-import Control.Monad.Catch (MonadCatch)
-import qualified Data.Aeson as Aeson
-import qualified Data.HashMap.Strict as HashMap
-import Data.Text (Text)
-import Language.GraphQL.Error
-import Test.Hspec.Expectations (Expectation, expectationFailure, shouldBe, shouldNotSatisfy)
-
--- | Asserts that a query resolves to some value.
-shouldResolveTo :: MonadCatch m
- => Either (ResponseEventStream m Aeson.Value) Aeson.Object
- -> Aeson.Object
- -> Expectation
-shouldResolveTo (Right actual) expected = actual `shouldBe` expected
-shouldResolveTo _ _ = expectationFailure
- "the query is expected to resolve to a value, but it resolved to an event stream"
-
--- | Asserts that the response doesn't contain any errors.
-shouldResolve :: MonadCatch m
- => (Text -> IO (Either (ResponseEventStream m Aeson.Value) Aeson.Object))
- -> Text
- -> Expectation
-shouldResolve executor query = do
- actual <- executor query
- case actual of
- Right response ->
- response `shouldNotSatisfy` HashMap.member "errors"
- _ -> expectationFailure
- "the query is expected to resolve to a value, but it resolved to an event stream"
-#else
-module Test.Hspec.GraphQL {-# DEPRECATED "Use graphql-spice package instead" #-}
- (
- ) where
-#endif