Skip to content

Commit

Permalink
remove integration coin selection scenarios that are no-longer applic…
Browse files Browse the repository at this point in the history
…able.

  Indeed, the wallet now _always_ create a change output. The only way
  to empty a wallet is to use the migration / swapping endpoints.
  • Loading branch information
KtorZ committed Jan 27, 2021
1 parent 9b9bd2f commit 971cd17
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import Test.Integration.Framework.DSL
, expectField
, expectResponseCode
, fixtureIcarusWallet
, fixtureIcarusWalletWith
, listAddresses
, minUTxOValue
, request
Expand Down Expand Up @@ -160,34 +159,3 @@ spec = describe "BYRON_COIN_SELECTION" $ do
[ expectResponseCode HTTP.status404
, expectErrorMessage (errMsg404NoWallet $ icW ^. walletId)
]

it "BYRON_COIN_SELECTION_05 - \
\No change when payment fee eats leftovers due to minUTxOValue" $
\ctx -> runResourceT $ do
source <- fixtureIcarusWalletWith @n ctx [minUTxOValue, minUTxOValue]
target <- emptyWallet ctx

targetAddress:_ <- fmap (view #id) <$> listAddresses @n ctx target
let amt = Quantity minUTxOValue
let payment = AddressAmount targetAddress amt mempty
let output = ApiCoinSelectionOutput targetAddress amt
let isValidDerivationPath path =
( length path == 5 )
&&
( [ ApiT $ DerivationIndex $ getIndex purposeBIP44
, ApiT $ DerivationIndex $ getIndex coinTypeAda
, ApiT $ DerivationIndex $ getIndex @'Hardened minBound
] `isPrefixOf` NE.toList path
)
selectCoins @_ @'Byron ctx source (payment :| []) >>= flip verify
[ expectResponseCode HTTP.status200
, expectField #inputs
(`shouldSatisfy` (not . null))
, expectField #inputs
(`shouldSatisfy` all
(isValidDerivationPath . view #derivationPath))
, expectField #change
(`shouldSatisfy` null)
, expectField #outputs
(`shouldBe` [output])
]
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ import Test.Integration.Framework.DSL
, Headers (..)
, Payload (..)
, emptyWallet
, eventually
, expectErrorMessage
, expectField
, expectResponseCode
, fixtureWallet
, fixtureWalletWith
, json
, listAddresses
, minUTxOValue
Expand Down Expand Up @@ -215,45 +213,3 @@ spec = describe "SHELLEY_COIN_SELECTION" $ do
r <- request @(ApiCoinSelection n) ctx
(Link.selectCoins @'Shelley w) headers payload
verify r expectations

it "WALLETS_COIN_SELECTION_05 - \
\No change when payment fee eats leftovers due to minUTxOValue" $
\ctx -> runResourceT $ do
source <- fixtureWalletWith @n ctx [minUTxOValue, minUTxOValue]
eventually "Source wallet balance is as expected" $ do
rGet <- request @ApiWallet ctx
(Link.getWallet @'Shelley source) Default Empty
verify rGet
[ expectField
(#balance . #total)
(`shouldBe` Quantity (2 * minUTxOValue))
, expectField
(#balance . #available)
(`shouldBe` Quantity (2 * minUTxOValue))
]
target <- emptyWallet ctx

targetAddress:_ <- fmap (view #id) <$> listAddresses @n ctx target
let amount = Quantity minUTxOValue
let payment = AddressAmount targetAddress amount mempty
let output = ApiCoinSelectionOutput targetAddress amount
let isValidDerivationPath path =
( length path == 5 )
&&
( [ ApiT $ DerivationIndex $ getIndex purposeCIP1852
, ApiT $ DerivationIndex $ getIndex coinTypeAda
, ApiT $ DerivationIndex $ getIndex @'Hardened minBound
] `isPrefixOf` NE.toList path
)
selectCoins @_ @'Shelley ctx source (payment :| []) >>= flip verify
[ expectResponseCode HTTP.status200
, expectField #inputs
(`shouldSatisfy` (not . null))
, expectField #inputs
(`shouldSatisfy` all
(isValidDerivationPath . view #derivationPath))
, expectField #change
(`shouldSatisfy` null)
, expectField #outputs
(`shouldBe` [output])
]

0 comments on commit 971cd17

Please sign in to comment.