Skip to content
Permalink
Browse files

review formatting in CLISpec.hs

  • Loading branch information...
KtorZ committed May 16, 2019
1 parent 04eb7fc commit 60cff925079521cf87f2630c0734169afdb21b67
Showing with 26 additions and 25 deletions.
  1. +26 −25 lib/http-bridge/test/integration/Test/Integration/Scenario/CLISpec.hs
@@ -64,49 +64,48 @@ specNoCluster = do
length (words out) `shouldBe` 15
c `shouldBe` ExitSuccess

describe "CLI - Can generate mnemonics with different sizes" $ do
forM_ [9, 12, 15, 18, 21, 24] $ \size -> it (show size) $ do
(Exit c, Stdout out) <- command [] "cardano-wallet"
["mnemonic", "generate", "--size", show size]
length (words out) `shouldBe` size
c `shouldBe` ExitSuccess
describe "CLI - Can generate mnemonics with different sizes" $ do
let test size = it ("--size=" <> show size) $ do
(Exit c, Stdout out) <- command [] "cardano-wallet"
["mnemonic", "generate", "--size", show size]
length (words out) `shouldBe` size
c `shouldBe` ExitSuccess
forM_ [9, 12, 15, 18, 21, 24] test

specWithCluster :: SpecWith Context
specWithCluster = do
it "CLI - Can get a wallet" $ \ctx -> do
walId <- createWallet ctx "1st CLI Wallet" mnemonics15
(Exit c, Stdout out) <- command [] "cardano-wallet"
["wallet", "get", "--port", "1337", walId ]
["wallet", "get", "--port", "1337", walId ]
out `shouldContain` "1st CLI Wallet"
c `shouldBe` ExitSuccess

it "CLI - Can list wallets" $ \ctx -> do
_ <- createWallet ctx "1st CLI Wallet" mnemonics15
_ <- createWallet ctx "2nd CLI Wallet" mnemonics18
(Exit c, Stdout out) <- command [] "cardano-wallet"
["wallet", "list", "--port", "1337"]
["wallet", "list", "--port", "1337"]
out `shouldContain` "1st CLI Wallet"
out `shouldContain` "2nd CLI Wallet"
c `shouldBe` ExitSuccess

it "CLI - Can update wallet name" $ \ctx -> do
walId <- createWallet ctx "1st CLI Wallet" mnemonics15
(Exit c, Stdout out) <- command [] "cardano-wallet"
["wallet", "update", "--port", "1337", walId
, "--name", "Updated name" ]
out `shouldContain` "Updated name"
["wallet", "update", "--port", "1337", walId , "--name", "new name" ]
out `shouldContain` "new name"
c `shouldBe` ExitSuccess

it "CLI - Can delete wallet" $ \ctx -> do
walId <- createWallet ctx "CLI Wallet" mnemonics15
(Exit c, Stdout out) <- command [] "cardano-wallet"
["wallet", "delete", "--port", "1337", walId ]
["wallet", "delete", "--port", "1337", walId ]
out `shouldNotContain` "CLI Wallet"
c `shouldBe` ExitSuccess
where

createWallet :: Context -> Text -> [Text] -> IO String
createWallet ctx name mnemonics = do
where
createWallet :: Context -> Text -> [Text] -> IO String
createWallet ctx name mnemonics = do
let payload = Json [json| {
"name": #{name},
"mnemonic_sentence": #{mnemonics},
@@ -116,12 +115,14 @@ specWithCluster = do
expectResponseCode @IO HTTP.status202 r
return (T.unpack $ getFromResponse walletId r)

mnemonics15 :: [Text]
mnemonics15 = ["network", "empty", "cause", "mean", "expire", "private",
"finger", "accident", "session", "problem", "absurd", "banner", "stage",
"void", "what"]

mnemonics18 :: [Text]
mnemonics18 = ["whisper", "control", "diary", "solid", "cattle", "salmon",
"whale", "slender", "spread", "ice", "shock", "solve", "panel",
"caution", "upon", "scatter", "broken", "tonight"]
mnemonics15 :: [Text]
mnemonics15 =
[ "network", "empty", "cause", "mean", "expire"
, "private", "finger", "accident", "session", "problem"
, "absurd", "banner", "stage", "void", "what"]

mnemonics18 :: [Text]
mnemonics18 =
[ "whisper", "control", "diary", "solid", "cattle", "salmon"
, "whale", "slender", "spread", "ice", "shock", "solve"
, "panel", "caution", "upon", "scatter", "broken", "tonight"]

0 comments on commit 60cff92

Please sign in to comment.
You can’t perform that action at this time.