Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
setzeus committed Oct 11, 2024
1 parent dc9bbdd commit 7f28d91
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions contracts/tests/sbtc-withdrawal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,44 @@ describe("Reject a withdrawal request", () => {
);
expect(receipt.value).toEqual(errors.withdrawal.ERR_ALREADY_PROCESSED);
});
test("Fails when Bitcoin forks", () => {
// Alice initiates withdrawalrequest
txOk(
deposit.completeDepositWrapper({
txid: new Uint8Array(32).fill(0),
voutIndex: 0,
amount: 1001n,
recipient: alice,
}),
deployer
);
txOk(

Check failure on line 724 in contracts/tests/sbtc-withdrawal.test.ts

View workflow job for this annotation

GitHub Actions / Contract tests

tests/sbtc-withdrawal.test.ts > Reject a withdrawal request > Fails when Bitcoin forks

Error: Tx result failed. Expected OK, received ERR 1. ❯ c ../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@clarigen/test/src/utils.ts:39:13 ❯ Module.F ../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@clarigen/test/src/index.ts:38:17 ❯ tests/sbtc-withdrawal.test.ts:724:5
withdrawal.initiateWithdrawalRequest({
amount: 1000n,
recipient: alicePoxAddr,
maxFee: 10n,
}),
alice
);
const receipt = txErr(
withdrawal.completeWithdrawals({
withdrawals: [
{
requestId: 1n,
status: true,
signerBitmap: 1n,
bitcoinTxid: new Uint8Array(32).fill(1),
outputIndex: 10n,
fee: 10n,
}
],
burnHeight: 10n,
burnHash: new Uint8Array(32).fill(0),
}),
deployer
);
expect(receipt.value).toEqual(errors.withdrawal.ERR_INVALID_BURN_HASH);
});
test("Successfully reject a requested withdrawal", () => {
// Alice initiates withdrawalrequest
txOk(
Expand Down

0 comments on commit 7f28d91

Please sign in to comment.