Skip to content

Commit

Permalink
Fix integration tests:
Browse files Browse the repository at this point in the history
STAKE_POOLS_JOIN_EMPTY, TRANS_NEW_BALANCE_02a, TRANS_NEW_CREATE_04d
  • Loading branch information
Unisay committed Dec 27, 2023
1 parent e99224d commit 5f848e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,19 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment
)

externalSelectedUtxo <- extractExternallySelectedUTxO ptx
let utxoSelection =
UTxOSelection.fromIndexPair
(internalUtxoAvailable, externalSelectedUtxo)

when (UTxOSelection.availableSize utxoSelection == 0) $
throwE ErrBalanceTxUnableToCreateInput

let mSel = selectAssets
pp
utxoAssumptions
(F.toList $ partialTx ^. bodyTxL . outputsTxBodyL)
redeemers
(UTxOSelection.fromIndexPair
(internalUtxoAvailable, externalSelectedUtxo))
utxoSelection
balance0
(Convert.toWalletCoin minfee0)
randomSeed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ import Test.Integration.Framework.DSL
, emptyRandomWallet
, emptyWallet
, eventually
, expectErrorInfo
, expectErrorMessage
, expectField
, expectListField
Expand Down Expand Up @@ -917,18 +918,18 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do
NotEnoughMoney {} -> True
_someOtherError -> False

it "TRANS_NEW_CREATE_04d - Not enough money emptyWallet" $ \ctx -> runResourceT $ do
it "TRANS_NEW_CREATE_04d - No UTxOs available" $ \ctx -> runResourceT $ do
wa <- emptyWallet ctx
wb <- emptyWallet ctx

payload <- liftIO $ mkTxPayload ctx wb (minUTxOValue (_mainEra ctx)) 1

rTx <- request @(ApiConstructTransaction n) ctx
request @(ApiConstructTransaction n) ctx
(Link.createUnsignedTransaction @'Shelley wa) Default payload
verify rTx [expectResponseCode HTTP.status403]
decodeErrorInfo rTx `shouldSatisfy` \case
NotEnoughMoney {} -> True
_someOtherError -> False
>>= flip verify
[ expectResponseCode HTTP.status403
, expectErrorInfo (`shouldBe` NoUtxosAvailable)
]

it "TRANS_NEW_CREATE_04e- Multiple Output Tx to single wallet" $ \ctx -> runResourceT $ do
wa <- fixtureWallet ctx
Expand Down Expand Up @@ -2368,12 +2369,12 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do
\ctx -> runResourceT $ do
wa <- emptyWallet ctx
let balancePayload = Json PlutusScenario.pingPong_1
rTx <- request @ApiSerialisedTransaction ctx
(Link.balanceTransaction @'Shelley wa) Default balancePayload
verify rTx [expectResponseCode HTTP.status403]
decodeErrorInfo rTx `shouldSatisfy` \case
NotEnoughMoney {} -> True
_someOtherError -> False
request @ApiSerialisedTransaction
ctx (Link.balanceTransaction @'Shelley wa) Default balancePayload
>>= flip verify
[ expectResponseCode HTTP.status403
, expectErrorInfo (`shouldBe` NoUtxosAvailable)
]

it "TRANS_NEW_BALANCE_02b - Cannot balance when I cannot afford fee" $
\ctx -> runResourceT $ do
Expand Down

0 comments on commit 5f848e9

Please sign in to comment.