packages feed

morpheus-graphql-tests 0.28.1 → 0.28.2

raw patch · 6 files changed

+32/−31 lines, 6 filesdep ~bytestringdep ~tastydep ~unordered-containers

Dependency ranges changed: bytestring, tasty, unordered-containers

Files

morpheus-graphql-tests.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.36.0.+-- This file has been generated from package.yaml by hpack version 0.38.1. -- -- see: https://github.com/sol/hpack  name:           morpheus-graphql-tests-version:        0.28.1+version:        0.28.2 synopsis:       Morpheus GraphQL Test description:    test utils for morpheus graphql category:       web, graphql, test@@ -37,11 +37,11 @@   build-depends:       aeson >=1.4.4 && <3.0.0     , base >=4.7.0 && <5.0.0-    , bytestring >=0.10.4 && <0.15.0+    , bytestring >=0.10.4 && <1.0.0     , directory >=1.0.0 && <2.0.0     , relude >=0.3.0 && <2.0.0-    , tasty >=0.1.0 && <=1.5+    , tasty >=0.1.0 && <2.0.0     , tasty-hunit >=0.1.0 && <1.0.0     , text >=1.2.3 && <3.0.0-    , unordered-containers >=0.2.8 && <0.3.0+    , unordered-containers >=0.2.8 && <1.0.0   default-language: Haskell2010
src/Test/Morpheus.hs view
@@ -46,8 +46,8 @@ mainTest :: String -> [IO TestTree] -> IO () mainTest name xs = do   tests <- sequence xs-  defaultMain $-    testGroup+  defaultMain+    $ testGroup       name       tests 
src/Test/Morpheus/File.hs view
@@ -26,7 +26,7 @@ import System.Directory (doesDirectoryExist, listDirectory)  class ReadSource t where-  readSource :: ToString name => name -> IO t+  readSource :: (ToString name) => name -> IO t  instance ReadSource Text where   readSource = T.readFile . toString@@ -34,15 +34,15 @@ instance ReadSource ByteString where   readSource = L.readFile . toString -withSource :: ReadSource t => (String, String) -> FileUrl -> IO t+withSource :: (ReadSource t) => (String, String) -> FileUrl -> IO t withSource (name, format) url   | isDir url = readSource $ toString url <> "/" <> name <> "." <> format   | otherwise = readSource $ toString url <> "." <> format -readGQL :: ReadSource t => String -> FileUrl -> IO t+readGQL :: (ReadSource t) => String -> FileUrl -> IO t readGQL x = withSource (x, "gql") -readJSON :: ReadSource t => String -> FileUrl -> IO t+readJSON :: (ReadSource t) => String -> FileUrl -> IO t readJSON x = withSource (x, "json")  data FileUrl = FileUrl
src/Test/Morpheus/JSONDiff.hs view
@@ -36,7 +36,7 @@       <> "but it is:"       <> showLeaf y -showLeaf :: ToJSON a => a -> [Char]+showLeaf :: (ToJSON a) => a -> [Char] showLeaf x = " " <> unpack (encode x) <> "\n"  unescape :: String -> String@@ -79,7 +79,7 @@   | isJust (find (== x) xs) = uniq xs   | otherwise = x : uniq xs -jsonEQ :: ToJSON a => a -> a -> IO ()+jsonEQ :: (ToJSON a) => a -> a -> IO () jsonEQ expected actual = case diff (toJSON expected, toJSON actual) of   Just x -> assertFailure $ indent $ "\n" <> show x <> "\n"   Nothing -> pure ()
src/Test/Morpheus/Response.hs view
@@ -37,15 +37,15 @@   | Expected a   deriving (Generic, Eq) -instance FromJSON a => FromJSON (CaseAssertion a) where+instance (FromJSON a) => FromJSON (CaseAssertion a) where   parseJSON (String "OK") = pure OK   parseJSON v = Expected <$> parseJSON v -instance ToJSON a => ToJSON (CaseAssertion a) where+instance (ToJSON a) => ToJSON (CaseAssertion a) where   toJSON OK = String "OK"   toJSON (Expected v) = toJSON v -getResponse :: FromJSON a => FileUrl -> IO (CaseAssertion a)+getResponse :: (FromJSON a) => FileUrl -> IO (CaseAssertion a) getResponse = readJSON "response" >=> either fail pure . eitherDecode  assertResponse ::@@ -70,16 +70,16 @@  mkQuery :: (FromJSON a) => Value -> Maybe Value -> IO a mkQuery query variables =-  runResult $-    fromJSON $-      object-        [ "query" .= query,-          "variables" .= variables-        ]+  runResult+    $ fromJSON+    $ object+      [ "query" .= query,+        "variables" .= variables+      ] -fromEither :: ToJSON err => Either err a -> CaseAssertion err+fromEither :: (ToJSON err) => Either err a -> CaseAssertion err fromEither (Left err) = Expected err fromEither Right {} = OK -expects :: ToJSON a => a -> CaseAssertion Value+expects :: (ToJSON a) => a -> CaseAssertion Value expects = Expected . toJSON
src/Test/Morpheus/Utils.hs view
@@ -88,17 +88,18 @@  eqFailureMessage :: ByteString -> ByteString -> IO a3 eqFailureMessage expected actual =-  assertFailure $-    L.unpack $-      "expected: \n\n "-        <> expected-        <> " \n\n but got: \n\n "-        <> actual+  assertFailure+    $ L.unpack+    $ "expected: \n\n "+    <> expected+    <> " \n\n but got: \n\n "+    <> actual  getSchema :: (ReadSource a, Show err) => (a -> Either err b) -> FileUrl -> IO b getSchema f url =   readSchemaFile url-    >>= assertValidSchema . f+    >>= assertValidSchema+    . f  assertValidSchema :: (Show err) => Either err a -> IO a assertValidSchema =