Skip to content

Commit

Permalink
Add default TTL constant to tests DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Oct 7, 2020
1 parent cb3f516 commit 8170767
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions lib/core-integration/src/Test/Integration/Framework/DSL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ module Test.Integration.Framework.DSL
-- * Lens
, walletId

-- * Constants
, minUTxOValue
, defaultTxTTL

-- * Helpers
, (</>)
, (!!)
Expand Down Expand Up @@ -110,7 +114,6 @@ module Test.Integration.Framework.DSL
, rootPrvKeyFromMnemonics
, unsafeGetTransactionTime
, getTxId
, minUTxOValue

-- * Delegation helpers
, mkEpochInfo
Expand Down Expand Up @@ -215,6 +218,7 @@ import Cardano.Wallet.Primitive.Types
, HistogramBar (..)
, PoolId (..)
, SlotLength (..)
, SlotNo (..)
, SortOrder (..)
, TxIn (..)
, TxOut (..)
Expand Down Expand Up @@ -522,11 +526,20 @@ walletId =
_set (s, v) = set typed (ApiT $ WalletId (unsafeCreateDigest v)) s

--
-- Helpers
-- Constants
--

-- | Min UTxO parameter for the test cluster.
minUTxOValue :: Natural
minUTxOValue = 1_000_000

-- | Wallet server's chosen transaction TTL value (in slots) when none is given.
defaultTxTTL :: SlotNo
defaultTxTTL = 7200

--
-- Helpers
--
data MnemonicLength = M9 | M12 | M15 | M18 | M21 | M24 deriving (Show)

genMnemonics :: MnemonicLength -> IO [Text]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import Cardano.Wallet.Primitive.AddressDerivation.Icarus
import Cardano.Wallet.Primitive.Types
( Direction (..)
, Hash (..)
, SlotNo (SlotNo)
, SortOrder (..)
, TxMetadata (..)
, TxMetadataValue (..)
Expand Down Expand Up @@ -95,6 +94,7 @@ import Test.Integration.Framework.DSL
, Headers (..)
, Payload (..)
, between
, defaultTxTTL
, emptyByronWalletWith
, emptyRandomWallet
, emptyWallet
Expand Down Expand Up @@ -619,7 +619,7 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do
let sl = sinceBlock ^. #absoluteSlotNumber . #getApiT

-- The expected expiry slot (adds the hardcoded default ttl)
let ttl = sl + SlotNo 7200
let ttl = sl + defaultTxTTL

(view #absoluteSlotNumber <$> (apiTx ^. #expiresAt))
`shouldBe` Just (ApiT ttl)
Expand Down

0 comments on commit 8170767

Please sign in to comment.