From 07aac25079d73bcb66f4151049e5a5b175e2458c Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Wed, 5 Jun 2019 08:49:24 +0200 Subject: [PATCH] Rebase and code review fixes --- exe/wallet/Main.hs | 2 -- .../Test/Integration/Framework/DSL.hs | 21 +++---------------- .../Integration/Scenario/CLI/Addresses.hs | 2 +- .../Integration/Scenario/CLI/Transactions.hs | 4 ++-- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/exe/wallet/Main.hs b/exe/wallet/Main.hs index 095adc4dba4..8b11116a563 100644 --- a/exe/wallet/Main.hs +++ b/exe/wallet/Main.hs @@ -59,8 +59,6 @@ import Cardano.Wallet.Primitive.Mnemonic ( entropyToMnemonic, genEntropy, mnemonicToText ) import Cardano.Wallet.Primitive.Types ( DecodeAddress, EncodeAddress ) -import Control.Applicative - ( many ) import Control.Arrow ( second ) import Control.Monad diff --git a/lib/http-bridge/test/integration/Test/Integration/Framework/DSL.hs b/lib/http-bridge/test/integration/Test/Integration/Framework/DSL.hs index e55cc09a124..277c8fb1f12 100644 --- a/lib/http-bridge/test/integration/Test/Integration/Framework/DSL.hs +++ b/lib/http-bridge/test/integration/Test/Integration/Framework/DSL.hs @@ -319,9 +319,11 @@ expectEventually ctx getter target (_, res) = case res of let target' = getFromResponse getter r unless (target' >= target) $ loopUntilRestore wid +-- | Same as `expectEventually` but work directly on ApiWallet +-- , not response from the API expectEventually' :: (MonadIO m, MonadCatch m, MonadFail m, Ord a) - => Context + => Context t -> Lens' ApiWallet a -> a -> ApiWallet @@ -345,23 +347,6 @@ expectValidJSON _ str = Left e -> fail $ "expected valid JSON but failed decoding: " <> show e Right a -> return a --- | Expects wallet from the request to eventually reach the given state or --- beyond --- expectCliEventually --- :: (MonadIO m, MonadCatch m, MonadFail m, Ord a) --- => Lens' ApiWallet a --- -> a --- -> ApiWallet --- -> m () --- expectCliEventually getter target w = loopUntilRestore (w ^. walletId) --- where --- loopUntilRestore :: (MonadIO m, MonadCatch m) => Text -> IO () --- loopUntilRestore wid = do --- Stdout out <- getWalletViaCLI (T.unpack wid) --- outJson <- expectValidJSON (Proxy @ApiWallet) out --- let target' = view getter outJson --- unless (target' >= target) $ loopUntilRestore wid - expectCliFieldBetween :: (MonadIO m, MonadFail m, Show a, Ord a) => Lens' s a diff --git a/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Addresses.hs b/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Addresses.hs index 678f9afee48..2ceafa22fe6 100644 --- a/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Addresses.hs +++ b/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Addresses.hs @@ -42,7 +42,7 @@ spec = do walId <- emptyWallet' ctx (Exit c, Stdout out, Stderr err) <- listAddressesViaCLI walId err `shouldBe` "Ok.\n" - expectValidJSON (Proxy @[ApiAddress t]) out + _ <- expectValidJSON (Proxy @[ApiAddress t]) out c `shouldBe` ExitSuccess where diff --git a/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Transactions.hs b/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Transactions.hs index 8ca243142cf..9934a2701ea 100644 --- a/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Transactions.hs +++ b/lib/http-bridge/test/integration/Test/Integration/Scenario/CLI/Transactions.hs @@ -11,11 +11,11 @@ module Test.Integration.Scenario.CLI.Transactions import Prelude import Cardano.Wallet.Api.Types - ( ApiAddress, ApiTransaction, getApiT ) + ( ApiTransaction, ApiWallet, getApiT ) import Cardano.Wallet.Primitive.Types ( DecodeAddress (..) - , EncodeAddress (..) , Direction (..) + , EncodeAddress (..) , TxStatus (..) , encodeAddress )