diff --git a/.circleci/config.yml b/.circleci/config.yml index ba3135c009aec9459a4f0623fab72eeced6f6ea2..e778c0f93d5143a1608fa2712dc80f30d74dfd41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -84,6 +84,10 @@ jobs: # --no-terminal avoids having fancy progress reports written to # stdout. # + # --interleaved-output dumps realtime output on build progress. + # This may help avoid timeouts when building large packages (eg + # stripe-core). + # # --fast turns off compiler optimizations which probably doesn't # make a lot of difference in our code but it can speed up build # times for our dependencies (as well as reduce compiler memory @@ -99,6 +103,7 @@ jobs: # --no-haddock-deps skips building docs for all our dependencies. BUILD="stack build \ --no-terminal \ + --interleaved-output \ --fast \ --test \ --coverage \ diff --git a/PaymentServer.cabal b/PaymentServer.cabal index f22026483d217935bf139bd02a9829edc3cebd4b..7fc38d823cedcaf763bf6304360c2f98a0560925 100644 --- a/PaymentServer.cabal +++ b/PaymentServer.cabal @@ -78,6 +78,7 @@ test-suite PaymentServer-test , tasty-discover , tasty-quickcheck , tasty-hspec + , tasty-hunit , tasty-wai , servant-server , containers diff --git a/test/SpecRedemption.hs b/test/SpecRedemption.hs index 3143e1df60b570ae021626d5d404edfd833848f3..6e85850aef01062a5f0cf0f00075d7c94d817efb 100644 --- a/test/SpecRedemption.hs +++ b/test/SpecRedemption.hs @@ -20,6 +20,36 @@ import Servant , Proxy(Proxy) , serve ) +import Test.Tasty.Providers + ( TestName + , singleTest + ) +import Test.Tasty + ( TestTree + , testGroup + , withResource + ) +import Test.Tasty.HUnit + ( Assertion + , testCase + ) +import Test.Tasty.Wai + ( testWai + , assertStatus' + , assertBody + , assertHeader + , get + ) + +import Test.Tasty.QuickCheck + ( testProperty + ) + +import Network.HTTP.Types + ( status200 + , status405 + ) + import Test.Hspec ( Spec , parallel @@ -184,3 +214,23 @@ matchJSONBody expected = Just $ "decoded body does not equal expected value: " ++ show actual ++ show expected in MatchBody bodyMatcher + +-- testWithDatabase :: VoucherDatabase d => d -> Assertion +-- testWithDatabase database = +-- let +-- testApp = app trivialIssue database +-- in + +-- test_redemption :: TestTree +-- test_redemption = +-- let +-- testApp = memory >>= (return . app trivialIssue) +-- in +-- withResource testApp (\x -> return ()) $ \getApp -> +-- testGroup "Voucher Redemption" +-- [ testWai' getApp "a non-POST receives a 405 (Method Not Allowed) response" $ +-- do +-- res <- get "/" +-- assertStatus' status405 res +-- assertBody "blub" res +-- ]