-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: move remaining onchain-fee tests to new integration
- Loading branch information
Showing
2 changed files
with
57 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Wallets } from "@app" | ||
|
||
import { getOnChainWalletConfig } from "@config" | ||
|
||
import { PayoutSpeed } from "@domain/bitcoin/onchain" | ||
import { LessThanDustThresholdError } from "@domain/errors" | ||
|
||
import { AccountsRepository } from "@services/mongoose" | ||
|
||
import { createRandomUserAndWallets } from "test/helpers" | ||
|
||
let outsideAddress: OnChainAddress | ||
|
||
beforeAll(async () => { | ||
outsideAddress = "bcrt1qs758ursh4q9z627kt3pp5yysm78ddny6txaqgw" as OnChainAddress | ||
}) | ||
|
||
const amountBelowDustThreshold = getOnChainWalletConfig().dustThreshold - 1 | ||
|
||
describe("onChainPay", () => { | ||
describe("settles onchain", () => { | ||
it("fails to fetch fee for dust amount", async () => { | ||
const { btcWalletDescriptor, usdWalletDescriptor } = | ||
await createRandomUserAndWallets() | ||
const account = await AccountsRepository().findById(btcWalletDescriptor.accountId) | ||
if (account instanceof Error) throw account | ||
|
||
const resultBtcWallet = await Wallets.getOnChainFeeForBtcWallet({ | ||
walletId: btcWalletDescriptor.id, | ||
account, | ||
address: outsideAddress, | ||
amount: amountBelowDustThreshold, | ||
speed: PayoutSpeed.Fast, | ||
}) | ||
expect(resultBtcWallet).toBeInstanceOf(LessThanDustThresholdError) | ||
|
||
const resultUsdWallet = await Wallets.getOnChainFeeForUsdWallet({ | ||
walletId: usdWalletDescriptor.id, | ||
account, | ||
address: outsideAddress, | ||
amount: 1, | ||
speed: PayoutSpeed.Fast, | ||
}) | ||
expect(resultUsdWallet).toBeInstanceOf(LessThanDustThresholdError) | ||
|
||
const resultUsdWalletAndBtcAmount = | ||
await Wallets.getOnChainFeeForUsdWalletAndBtcAmount({ | ||
walletId: usdWalletDescriptor.id, | ||
account, | ||
address: outsideAddress, | ||
amount: amountBelowDustThreshold, | ||
speed: PayoutSpeed.Fast, | ||
}) | ||
expect(resultUsdWalletAndBtcAmount).toBeInstanceOf(LessThanDustThresholdError) | ||
}) | ||
}) | ||
}) |
221 changes: 0 additions & 221 deletions
221
test/legacy-integration/02-user-wallet/02-tx-onchain-fees.spec.ts
This file was deleted.
Oops, something went wrong.