Skip to content

Commit

Permalink
Add top level describe for each integration test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed Sep 15, 2020
1 parent f21f81d commit 102e110
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 26 deletions.
Expand Up @@ -101,7 +101,7 @@ spec :: forall n t.
, EncodeAddress n
, PaymentAddress n IcarusKey
) => SpecWith (Context t)
spec = do
spec = describe "BYRON_HW_WALLETS" $ do
it "HW_WALLETS_01 - Restoration from account public key preserves funds" $ \ctx -> do
wSrc <- fixtureIcarusWallet ctx
-- create wallet
Expand Down
Expand Up @@ -100,7 +100,7 @@ spec :: forall n t.
, PaymentAddress n IcarusKey
, PaymentAddress n ByronKey
) => SpecWith (Context t)
spec = do
spec = describe "BYRON_MIGRATIONS" $ do
it "BYRON_CALCULATE_01 - \
\for non-empty wallet calculated fee is > zero."
$ \ctx -> forM_ [fixtureRandomWallet, fixtureIcarusWallet]
Expand Down
Expand Up @@ -16,7 +16,7 @@ import Data.Quantity
import Data.Ratio
( (%) )
import Test.Hspec
( SpecWith, it, shouldBe )
( SpecWith, describe, it, shouldBe )
import Test.Integration.Framework.DSL
( Context (..)
, Headers (..)
Expand All @@ -31,7 +31,7 @@ import qualified Cardano.Wallet.Api.Link as Link
import qualified Network.HTTP.Types.Status as HTTP

spec :: forall t. SpecWith (Context t)
spec = do
spec = describe "BYRON_NETWORK" $ do
it "NETWORK_PARAMS - Able to fetch network parameters" $ \ctx -> do
r <- request @ApiNetworkParameters ctx Link.getNetworkParams Default Empty
expectResponseCode @IO HTTP.status200 r
Expand Down
Expand Up @@ -72,7 +72,7 @@ spec :: forall n t.
( DecodeAddress n
, DecodeStakeAddress n
) => SpecWith (Context t)
spec = do
spec = describe "BYRON_MIGRATIONS" $ do

it "BYRON_RESTORE_08 - Icarus wallet with high indexes" $ \ctx -> do
-- NOTE
Expand Down
Expand Up @@ -107,7 +107,7 @@ spec :: forall n t.
, EncodeAddress n
, PaymentAddress n ByronKey
) => SpecWith (Context t)
spec = do
spec = describe "BYRON_WALLETS" $ do
it "BYRON_GET_04, DELETE_01 - Deleted wallet is not available" $ \ctx -> do
w <- emptyRandomWallet ctx
_ <- request @ApiByronWallet ctx (Link.deleteWallet @'Byron w) Default Empty
Expand Down
Expand Up @@ -33,7 +33,7 @@ import Data.Maybe
import Data.Time.Clock
( getCurrentTime )
import Test.Hspec
( SpecWith, pendingWith, shouldBe )
( SpecWith, describe, pendingWith, shouldBe )
import Test.Hspec.Extra
( it )
import Test.Integration.Framework.DSL
Expand All @@ -56,7 +56,7 @@ import qualified Cardano.Wallet.Api.Link as Link
import qualified Network.HTTP.Types.Status as HTTP

spec :: forall t. SpecWith (Context t)
spec = do
spec = describe "COMMON_NETWORK" $ do
it "NETWORK - Can query network information" $ \ctx -> do
eventually "wallet's syncProgress = Ready" $ do
now <- liftIO getCurrentTime
Expand Down
Expand Up @@ -69,7 +69,7 @@ spec :: forall n t.
, DecodeStakeAddress n
, EncodeAddress n
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_ADDRESSES" $ do
it "BYRON_ADDRESS_LIST - Byron wallet on Shelley ep" $ \ctx -> do
w <- emptyRandomWallet ctx
let wid = w ^. walletId
Expand Down
Expand Up @@ -84,7 +84,7 @@ spec :: forall n t.
, DecodeStakeAddress n
, EncodeAddress n
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_HW_WALLETS" $ do
it "HW_WALLETS_01 - Restoration from account public key preserves funds" $ \ctx -> do
wSrc <- fixtureWallet ctx
-- create wallet
Expand Down
Expand Up @@ -97,7 +97,7 @@ spec :: forall n t.
, PaymentAddress n IcarusKey
, PaymentAddress n ByronKey
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_MIGRATIONS" $ do
it "SHELLEY_CALCULATE_01 - \
\for non-empty wallet calculated fee is > zero."
$ \ctx -> do
Expand All @@ -121,7 +121,7 @@ spec = do
, expectErrorMessage (errMsg403NothingToMigrate $ w ^. walletId)
]

it "SHELLEY_CALCULATE_02 - \
Hspec.it "SHELLEY_CALCULATE_02 - \
\Cannot calculate fee for wallet with dust, that cannot be migrated."
$ \ctx -> do
-- NOTE
Expand Down
Expand Up @@ -16,7 +16,7 @@ import Data.Quantity
import Data.Ratio
( (%) )
import Test.Hspec
( SpecWith, shouldBe, shouldNotBe )
( SpecWith, describe, shouldBe, shouldNotBe )
import Test.Hspec.Extra
( it )
import Test.Integration.Framework.DSL
Expand All @@ -35,7 +35,7 @@ import qualified Cardano.Wallet.Api.Link as Link
import qualified Network.HTTP.Types.Status as HTTP

spec :: forall t. SpecWith (Context t)
spec = do
spec = describe "SHELLEY_NETWORK" $ do
it "NETWORK_PARAMS - Able to fetch network parameters" $ \ctx ->
eventually "hardfork is detected in network parameters " $ do
r <- request @ApiNetworkParameters ctx Link.getNetworkParams Default Empty
Expand Down
Expand Up @@ -118,7 +118,7 @@ spec :: forall n t.
, EncodeAddress n
, PaymentAddress n ShelleyKey
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_STAKE_POOLS" $ do
let listPools ctx stake = request @[ApiStakePool] @IO ctx
(Link.listStakePools stake) Default Empty

Expand Down
Expand Up @@ -157,7 +157,7 @@ spec :: forall n t.
, EncodeAddress n
, PaymentAddress n IcarusKey
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_TRANSACTIONS" $ do
it "TRANS_MIN_UTXO_01 - I cannot spend less than minUTxOValue" $ \ctx -> do
wSrc <- fixtureWallet ctx
wDest <- emptyWallet ctx
Expand Down
Expand Up @@ -139,7 +139,7 @@ spec :: forall n t.
, PaymentAddress n IcarusKey
, PaymentAddress n ByronKey
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_WALLETS" $ do
it "WALLETS_CREATE_01 - Create a wallet" $ \ctx -> do
let payload = Json [json| {
"name": "1st Wallet",
Expand Down
Expand Up @@ -93,7 +93,7 @@ spec :: forall n t.
( DecodeAddress n
, KnownCommand t
) => SpecWith (Context t)
spec = do
spec = describe "BYRON_CLI_WALLETS" $ do

describe "CLI_BYRON_GET_04, CLI_BYRON_DELETE_01, BYRON_RESTORE_02, BYRON_RESTORE_03 -\
\ Deleted wallet is not available, but can be restored" $ do
Expand Down
Expand Up @@ -27,7 +27,7 @@ import Test.Integration.Framework.DSL
import qualified Data.List as L

spec :: forall t. KnownCommand t => SpecWith ()
spec = do
spec = describe "COMMON_CLI_MISC" $ do
it "CLI_VERSION - cardano-wallet shows version" $ do
(Exit c, Stdout out) <- cardanoWalletCLI @t ["version"]
let v = L.dropWhileEnd (== '\n') out
Expand Down
Expand Up @@ -35,7 +35,7 @@ import System.Command
import System.Exit
( ExitCode (..) )
import Test.Hspec
( SpecWith, pendingWith )
( SpecWith, describe, pendingWith )
import Test.Hspec.Expectations.Lifted
( shouldBe, shouldContain )
import Test.Hspec.Extra
Expand All @@ -54,7 +54,7 @@ import Test.Utils.Paths
( inNixBuild )

spec :: forall t. KnownCommand t => SpecWith (Context t)
spec = do
spec = describe "COMMON_CLI_NETWORK" $ do
it "CLI_NETWORK - cardano-wallet network information" $ \ctx -> do
info <- getNetworkInfoViaCLI ctx
let nextEpochNum =
Expand Down
Expand Up @@ -52,7 +52,7 @@ import qualified Data.Text.IO as TIO
spec
:: forall t s. (HasType (Port "wallet") s, KnownCommand t)
=> SpecWith s
spec = do
spec = describe "COMMON_CLI_PORTS" $ do
let overPort :: forall sym. HasType (Port sym) s => (Int -> Int) -> s -> s
overPort fn = over (typed @(Port sym)) (\(Port p) -> Port $ fn p)

Expand Down
Expand Up @@ -66,7 +66,7 @@ spec :: forall n t.
, DecodeAddress n
, EncodeAddress n
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_CLI_ADDRESSES" $ do

it "ADDRESS_LIST_01 - Can list addresses - default poolGap" $ \ctx -> do
let g = fromIntegral $ getAddressPoolGap defaultAddressPoolGap
Expand Down
Expand Up @@ -90,7 +90,7 @@ spec :: forall n t.
, DecodeStakeAddress n
, EncodeAddress n
) => SpecWith (Context t)
spec = describe "HW_WALLETS_CLI" $ do
spec = describe "SHELLEY_CLI_HW_WALLETS" $ do

it "HW_WALLETS_01x - Restoration from account public key preserves funds" $ \ctx -> do
wSrc <- fixtureWallet ctx
Expand Down
Expand Up @@ -104,7 +104,7 @@ spec :: forall n t.
, DecodeStakeAddress n
, EncodeAddress n
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_CLI_TRANSACTIONS" $ do
it "TRANS_CREATE_01 - Can create transaction via CLI" $ \ctx -> do
wSrc <- fixtureWallet ctx
wDest <- emptyWallet ctx
Expand Down
Expand Up @@ -103,7 +103,7 @@ spec :: forall n t.
, DecodeStakeAddress n
, EncodeAddress n
) => SpecWith (Context t)
spec = do
spec = describe "SHELLEY_CLI_WALLETS" $ do
it "BYRON_GET_03 - Shelley CLI does not show Byron wallet" $ \ctx -> do
wid <- emptyRandomWallet' ctx
(Exit c, Stdout out, Stderr err) <- getWalletViaCLI @t ctx wid
Expand Down

0 comments on commit 102e110

Please sign in to comment.