Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(test-suite): enable withdrawal tests #2202

Merged
merged 5 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading