Skip to content

Commit

Permalink
adjust expectations for fee and amt in Byron wallets' transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed Mar 25, 2023
1 parent c1be432 commit 3c87853
Showing 1 changed file with 25 additions and 14 deletions.
Expand Up @@ -335,9 +335,9 @@ spec = describe "BYRON_TRANSACTIONS" $ do
verify r
[ expectSuccess
, expectResponseCode HTTP.status202
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
, expectField (#amount . #getQuantity) $
between (feeEstMin + amt, feeEstMax + amt)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
, expectField (#status . #getApiT) (`shouldBe` Pending)
]

Expand All @@ -361,17 +361,21 @@ spec = describe "BYRON_TRANSACTIONS" $ do
(Link.getTransaction @'Byron wByron (ApiTxId txId)) Default Empty
verify rTxSrc
[ expectSuccess
, expectField (#amount . #getQuantity) (`shouldBe` amt + feeEstMax)
, expectField (#fee . #getQuantity) (`shouldBe` feeEstMax)
, expectField (#amount . #getQuantity) $
between (amt + feeEstMin, amt + feeEstMax)
, expectField (#fee . #getQuantity) $
between (feeEstMin, feeEstMax)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
]
rSrc <- request @ApiByronWallet ctx
(Link.getWallet @'Byron wByron) Default Empty
verify rSrc
[ expectSuccess
, expectField
(#balance . #available)
(`shouldBe` Quantity (faucetAmt - feeEstMax - amt))
, expectField (#balance . #total . #getQuantity) $
between
( faucetAmt - feeEstMax - amt
, faucetAmt - feeEstMin - amt
)
]

-- check that tx and balance on destination Shelley wallet is as expected
Expand All @@ -380,7 +384,8 @@ spec = describe "BYRON_TRANSACTIONS" $ do
verify rTxDest
[ expectSuccess
, expectField (#amount . #getQuantity) (`shouldBe` amt)
, expectField (#fee . #getQuantity) (`shouldBe` feeEstMax)
, expectField (#fee . #getQuantity) $
between (feeEstMin, feeEstMax)
, expectField (#direction . #getApiT) (`shouldBe` Incoming)
]
rTx <- request @ApiWallet ctx
Expand Down Expand Up @@ -450,7 +455,8 @@ spec = describe "BYRON_TRANSACTIONS" $ do
, expectField (#amount . #getQuantity) $
between (feeEstMin + amt, feeEstMax + amt)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
, expectField (#fee . #getQuantity) (`shouldBe` feeEstMax)
, expectField (#fee . #getQuantity) $
between (feeEstMin, feeEstMax)
]
let txId = getFromResponse (#id) rTx

Expand All @@ -461,7 +467,8 @@ spec = describe "BYRON_TRANSACTIONS" $ do
verify rTxDest
[ expectSuccess
, expectField (#amount . #getQuantity) (`shouldBe` amt)
, expectField (#fee . #getQuantity) (`shouldBe` feeEstMax)
, expectField (#fee . #getQuantity) $
between (feeEstMin, feeEstMax)
, expectField (#direction . #getApiT) (`shouldBe` Incoming)
]
rDest <- request @ApiByronWallet ctx
Expand All @@ -478,17 +485,21 @@ spec = describe "BYRON_TRANSACTIONS" $ do
(Link.getTransaction @'Byron wByron (ApiTxId txId)) Default Empty
verify rTxSrc
[ expectSuccess
, expectField (#amount . #getQuantity) (`shouldBe` amt + feeEstMax)
, expectField (#fee . #getQuantity) (`shouldBe` feeEstMax)
, expectField (#amount . #getQuantity) $
between (feeEstMin + amt, feeEstMax + amt)
, expectField (#fee . #getQuantity) $
between (feeEstMin, feeEstMax)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
]
rSrc <- request @ApiByronWallet ctx
(Link.getWallet @'Byron wByron) Default Empty
verify rSrc
[ expectSuccess
, expectField
(#balance . #available)
(`shouldBe` Quantity (faucetAmt - feeEstMax - amt))
, expectField (#balance . #total . #getQuantity) $
between
( faucetAmt - feeEstMax - amt
, faucetAmt - feeEstMin - amt
)
]

it "BYRON_TRANS_CREATE_02 -\
Expand Down

0 comments on commit 3c87853

Please sign in to comment.