sydtest-servant 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+22/−10 lines, 3 filesdep ~sydtestPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: sydtest
API changes (from Hackage documentation)
+ Test.Syd.Servant: instance Test.Syd.Run.IsTest (Servant.Client.Internal.HttpClient.ClientM ())
+ Test.Syd.Servant: instance Test.Syd.Run.IsTest (outerArgs -> Servant.Client.Internal.HttpClient.ClientM ())
Files
- src/Test/Syd/Servant.hs +13/−0
- sydtest-servant.cabal +2/−2
- test/Test/Syd/ServantSpec.hs +7/−8
src/Test/Syd/Servant.hs view
@@ -1,7 +1,10 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeFamilies #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} module Test.Syd.Servant ( servantSpec,@@ -59,3 +62,13 @@ testClientOrError :: ClientEnv -> ClientM a -> IO (Either ServantError a) testClientOrError = flip runClientM #endif++instance IsTest (ClientM ()) where+ type Arg1 (ClientM ()) = ()+ type Arg2 (ClientM ()) = ClientEnv+ runTest func = runTest (\() -> func)++instance IsTest (outerArgs -> ClientM ()) where+ type Arg1 (outerArgs -> ClientM ()) = outerArgs+ type Arg2 (outerArgs -> ClientM ()) = ClientEnv+ runTest func = runTest (\outerArgs clientEnv -> testClient clientEnv (func outerArgs))
sydtest-servant.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: sydtest-servant-version: 0.1.0.0+version: 0.2.0.0 synopsis: A servant companion library for sydtest category: Testing homepage: https://github.com/NorfairKing/sydtest#readme@@ -34,7 +34,7 @@ , servant , servant-client , servant-server- , sydtest+ , sydtest >=0.3.0.0 , sydtest-wai default-language: Haskell2010
test/Test/Syd/ServantSpec.hs view
@@ -13,11 +13,10 @@ spec :: Spec spec = servantSpecWithSetupFunc exampleAPI exampleSetupFunc $ do- it "gets zero at the start" $ \cenv -> do- r <- testClient cenv clientGet- r `shouldBe` 0- it "can add 1 to get 1" $ \cenv -> do- r <- testClient cenv $ do- NoContent <- clientAdd 1- clientGet- r `shouldBe` 1+ it "gets zero at the start" $ do+ r <- clientGet+ liftIO $ r `shouldBe` 0+ it "can add 1 to get 1" $ do+ NoContent <- clientAdd 1+ r <- clientGet+ liftIO $ r `shouldBe` 1