From 4794d63b60742150bd845bb215231602ce371507 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Thu, 29 Aug 2019 19:46:00 -0400 Subject: [PATCH] hlint suggested improvements --- test/SpecPersistence.hs | 13 ++++++------- test/SpecStripe.hs | 2 +- test/Util/Gen.hs | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/test/SpecPersistence.hs b/test/SpecPersistence.hs index 3fdca1b..db6d8a5 100644 --- a/test/SpecPersistence.hs +++ b/test/SpecPersistence.hs @@ -7,10 +7,6 @@ module SpecPersistence where -import Test.QuickCheck - ( Property - , (==>) - ) import Control.Monad.IO.Class ( liftIO ) @@ -23,7 +19,9 @@ import Test.Hspec.Expectations ( shouldReturn ) import Test.QuickCheck - ( property + ( Property + , property + , (==>) ) import Test.QuickCheck.Monadic ( monadicIO @@ -77,8 +75,9 @@ paidVoucherMismatchFingerprint getDB = property $ \voucher fingerprint fingerpri redeem fingerprint' `shouldReturn` Left AlreadyRedeemed makeSpec :: VoucherDatabase d => IO d -> Spec -makeSpec getDB = do - describe "voucher interactions" $ do +makeSpec getDB = + describe "voucher interactions" $ + do it "denies redemption of a not-paid-for voucher" $ unpaidVoucherNotRedeemable getDB it "allows redemption of paid-for vouchers" $ paidVoucherRedeemable getDB it "allows multiple redemption as long as the same fingerprint is used" $ paidVoucherMultiRedeemable getDB diff --git a/test/SpecStripe.hs b/test/SpecStripe.hs index 0576c8b..23ad293 100644 --- a/test/SpecStripe.hs +++ b/test/SpecStripe.hs @@ -77,7 +77,7 @@ stripeAPI :: Proxy StripeAPI stripeAPI = Proxy app :: IO Application -app = memory >>= return . stripeServer >>= return . serve stripeAPI +app = serve stripeAPI . stripeServer <$> memory spec_webhook :: Spec spec_webhook = with app $ do diff --git a/test/Util/Gen.hs b/test/Util/Gen.hs index e74de2b..ffba412 100644 --- a/test/Util/Gen.hs +++ b/test/Util/Gen.hs @@ -163,7 +163,7 @@ charges withVoucher = if withVoucher then metaDatasWithVoucher else - metaDatasWithVoucher + metaDatasWithoutVoucher ) -- chargeMetaData :: MetaData <*> arbitrary -- chargeStatementDescription :: Maybe StatementDescription <*> arbitrary -- chargeReceiptEmail :: Maybe Text @@ -184,4 +184,4 @@ posixTimes :: Gen UTCTime posixTimes = (arbitrary :: Gen Integer) `suchThatMap` (Just . posixSecondsToUTCTime . fromIntegral . abs) hasVoucher :: MetaData -> Bool -hasVoucher (MetaData items) = any (== "Voucher") . (map fst) $ items +hasVoucher (MetaData items) = elem "Voucher" . map fst $ items -- GitLab