Skip to content

Commit

Permalink
Small refactor of WalletSpec as suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Nov 23, 2023
1 parent 1decee4 commit 1b7e1f6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hydra-node/test/Hydra/Chain/Direct/WalletSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ prop_setsMinUTxOValue =
forAllBlind (resize 0 genLedgerTx) $ \tx ->
forAllBlind (reasonablySized $ genOutputsForInputs tx) $ \lookupUTxO ->
forAllBlind (reasonablySized genUTxO) $ \walletUTxO ->
-- Generate another txOut and make it deliberately "under-valued"
forAll arbitrary $ \txOut -> do
let txOutWithoutADA = txOut & coinTxOutL .~ mempty
forAll genTxOutWithoutADA $ \txOutWithoutADA -> do
let newTx = tx & bodyTxL . outputsTxBodyL <>~ StrictSeq.singleton txOutWithoutADA
case coverFee_ Fixture.pparams Fixture.systemStart Fixture.epochInfo lookupUTxO walletUTxO newTx of
Left err ->
Expand All @@ -215,6 +213,9 @@ prop_setsMinUTxOValue =
let outs = toList $ balancedTx ^. bodyTxL . outputsTxBodyL
not (any (\o -> o ^. coinTxOutL == mempty) outs)
& counterexample ("No 0 ADA outputs expected:\n" <> show outs)
where
-- Generate a deliberately "under-valued" TxOut
genTxOutWithoutADA = arbitrary <&> coinTxOutL .~ mempty

prop_balanceTransaction :: Property
prop_balanceTransaction =
Expand Down

0 comments on commit 1b7e1f6

Please sign in to comment.