Skip to content

Commit

Permalink
Also adjust "The same account and mnemonic wallet can live side-by-si…
Browse files Browse the repository at this point in the history
…de" test
  • Loading branch information
Anviking committed Oct 28, 2020
1 parent 4df964f commit 0f22f38
Showing 1 changed file with 6 additions and 13 deletions.
Expand Up @@ -32,7 +32,7 @@ import Control.Monad
import Control.Monad.Trans.Resource
( ResourceT, runResourceT )
import Data.Generics.Internal.VL.Lens
( (^.) )
( view, (^.) )
import Data.Proxy
( Proxy (..) )
import Data.Quantity
Expand Down Expand Up @@ -313,29 +313,22 @@ spec = describe "SHELLEY_CLI_HW_WALLETS" $ do
(c1, o1, e1) <- createWalletViaCLI @t ctx [mnemonicWalName] m "\n" "secure-passphrase"
c1 `shouldBe` ExitSuccess
T.unpack e1 `shouldContain` cmdOk
_ <- expectValidJSON (Proxy @ApiWallet) o1
mnemonicWal <- expectValidJSON (Proxy @ApiWallet) o1

-- create wallet from pub key
let accXPub = pubKeyFromMnemonics' (words m)
(Exit c2, Stdout o2, Stderr e2) <-
createWalletFromPublicKeyViaCLI @t ctx [pubKeyWalName, accXPub]
c2 `shouldBe` ExitSuccess
e2 `shouldContain` cmdOk
_ <- expectValidJSON (Proxy @ApiWallet) o2
pubKeyWal <- expectValidJSON (Proxy @ApiWallet) o2

(Exit c, Stdout out, Stderr err) <- listWalletsViaCLI @t ctx
wids <- map (view walletId) <$> expectValidJSON (Proxy @[ApiWallet]) out
c `shouldBe` ExitSuccess
err `shouldBe` cmdOk
rl <- expectValidJSON (Proxy @[ApiWallet]) out
length rl `shouldBe` 2
verify rl
[ expectCliListField 0
(#name . #getApiT . #getWalletName)
(`shouldBe` T.pack mnemonicWalName)
, expectCliListField 1
(#name . #getApiT . #getWalletName)
(`shouldBe` T.pack pubKeyWalName)
]
wids `shouldContain` [mnemonicWal ^. walletId]
wids `shouldContain` [pubKeyWal ^. walletId]

describe "HW_WALLETS_06 - Test parameters" $ do
describe "Wallet names valid" $ do
Expand Down

0 comments on commit 0f22f38

Please sign in to comment.