Skip to content

Commit

Permalink
test(test-suite): enable withdrawal tests (#2202)
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov authored Oct 5, 2024
1 parent 1c8a83f commit 59aadb0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export async function creditWithdrawal(

// eslint-disable-next-line no-param-reassign
options = {
...options,
signingKeyIndex: 3,
...options,
};

const { dpp } = this;
Expand Down
24 changes: 16 additions & 8 deletions packages/platform-test-suite/test/e2e/withdrawals.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const waitForSTPropagated = require('../../lib/waitForSTPropagated');

// TODO: temporary disabled due to flakiness. These tests aren't important for now, since we are
// going to release v1.0.0 with withdrawals disabled.
describe.skip('Withdrawals', function withdrawalsTest() {
describe('Withdrawals', function withdrawalsTest() {
this.bail(true);

let client;
Expand Down Expand Up @@ -38,7 +38,7 @@ describe.skip('Withdrawals', function withdrawalsTest() {
});

describe('Any Identity', () => {
const INITIAL_BALANCE = 1000000;
const INITIAL_BALANCE = 2000000;

before(async () => {
identity = await client.platform.identities.register(INITIAL_BALANCE);
Expand All @@ -57,7 +57,9 @@ describe.skip('Withdrawals', function withdrawalsTest() {
await client.platform.identities.withdrawCredits(
identity,
BigInt(amountToWithdraw),
withdrawTo.address,
{
toAddress: withdrawTo.address,
},
);

// Re-fetch identity to obtain latest core chain lock height
Expand Down Expand Up @@ -125,7 +127,9 @@ describe.skip('Withdrawals', function withdrawalsTest() {
const { height: withdrawalHeight } = await client.platform.identities.withdrawCredits(
identity,
BigInt(amountToWithdraw),
withdrawTo.address,
{
toAddress: withdrawTo.address,
},
);

let withdrawalBroadcasted = false;
Expand Down Expand Up @@ -173,7 +177,9 @@ describe.skip('Withdrawals', function withdrawalsTest() {
await expect(client.platform.identities.withdrawCredits(
identity,
BigInt(amountToWithdraw),
withdrawTo.address,
{
toAddress: withdrawTo.address,
},
)).to.be.rejectedWith(`Withdrawal amount "${amountToWithdraw}" is bigger that identity balance "${identityBalanceBefore}"`);
});

Expand All @@ -186,11 +192,11 @@ describe.skip('Withdrawals', function withdrawalsTest() {
await expect(client.platform.identities.withdrawCredits(
identity,
BigInt(amountToWithdraw),
withdrawTo.address,
{
toAddress: withdrawTo.address,
signingKeyIndex: 1,
},
)).to.be.rejectedWith('Error conversion not implemented: Invalid public key security level HIGH. The state transition requires one of CRITICAL');
)).to.be.rejectedWith('Error conversion not implemented: Invalid public key security level HIGH. The state transition requires one of MASTER');
});

// TODO: Figure out how to overcome client-side validation and implement
Expand Down Expand Up @@ -227,7 +233,9 @@ describe.skip('Withdrawals', function withdrawalsTest() {
await client.platform.identities.withdrawCredits(
identity,
BigInt(1000000),
withdrawTo.address,
{
toAddress: withdrawTo.address,
},
);

await waitForSTPropagated();
Expand Down

0 comments on commit 59aadb0

Please sign in to comment.