Skip to content

Commit

Permalink
add extra scenario covering fee estimation edge-case in the presence …
Browse files Browse the repository at this point in the history
…of withdrawal

  This currently fails, 'as expected', next commit will fix the issue.
  • Loading branch information
KtorZ committed Aug 27, 2020
1 parent b35d737 commit f6e74dc
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import Test.Integration.Framework.DSL
, utcIso8601ToText
, verify
, walletId
, (.<=)
, (.>)
, (.>=)
)
Expand Down Expand Up @@ -555,14 +556,35 @@ spec = do
(Link.getTransactionFee @'Shelley w) Default payload
expectResponseCode @IO HTTP.status400 r

it "TRANS_ESTIMATE_03 - we see result when we can't cover fee" $ \ctx -> do
it "TRANS_ESTIMATE_03a - we see result when we can't cover fee" $ \ctx -> do
wSrc <- fixtureWallet ctx
payload <- mkTxPayload ctx wSrc faucetAmt fixturePassphrase
r <- request @ApiFee ctx
(Link.getTransactionFee @'Shelley wSrc) Default payload
verify r
[ expectResponseCode HTTP.status202
, expectField (#estimatedMin . #getQuantity) (.>= 0)
, expectField (#estimatedMax . #getQuantity) (.<= oneAda)
]

it "TRANS_ESTIMATE_03b - we see result when we can't cover fee (with withdrawal)" $ \ctx -> do
(wSrc, _) <- rewardWallet ctx
addr:_ <- fmap (view #id) <$> listAddresses @n ctx wSrc
let totalBalance = wSrc ^. #balance . #getApiT . #total
let payload = Json [json|{
"withdrawal": "self",
"payments": [{
"address": #{addr},
"amount": #{totalBalance}
}],
"passphrase": #{fixturePassphrase}
}|]
r <- request @ApiFee ctx
(Link.getTransactionFee @'Shelley wSrc) Default payload
verify r
[ expectResponseCode HTTP.status202
, expectField (#estimatedMin . #getQuantity) (.>= 0)
, expectField (#estimatedMax . #getQuantity) (.<= oneAda)
]

it "TRANS_ESTIMATE_04 - Not enough money" $ \ctx -> do
Expand Down

0 comments on commit f6e74dc

Please sign in to comment.