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

Using 'parameterized tests' for 2wp.js pegin tests #89

Conversation

jeremy-then
Copy link
Contributor

No description provided.

@jeremy-then jeremy-then self-assigned this Sep 18, 2024
@jeremy-then jeremy-then requested a review from a team as a code owner September 18, 2024 04:00
Copy link

sonarcloud bot commented Sep 18, 2024

const legacyPeginTestsHappyPath = [
{
description: 'should do legacy pegin with one input and one output to the federation',
initialBtcSenderBalancesInBtc: [ MINIMUM_PEGIN_VALUE_IN_BTC ],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can fetch this value using an async function. You just need to execute it once you are executing the test.

{
description: 'should do legacy pegin with multiple inputs from different accounts and one output to the federation',
initialBtcSenderBalancesInBtc: [ MINIMUM_PEGIN_VALUE_IN_BTC, MINIMUM_PEGIN_VALUE_IN_BTC, MINIMUM_PEGIN_VALUE_IN_BTC ], // Each sender is funded with some amount
btcSenderAmountsToSendToFed: [ MINIMUM_PEGIN_VALUE_IN_BTC, MINIMUM_PEGIN_VALUE_IN_BTC, MINIMUM_PEGIN_VALUE_IN_BTC ], // Each sender decides how much to send to the federation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btcSenderAmountsToSendToFed seems a bit complex name to me. Maybe peginSenderAmounts by including pegin, we can assume this refers to funds sent to fed. Wdyt?

return await Promise.all(sendersInfo.map(senderInfo => rskTxHelper.getBalance(senderInfo.rskRecipientRskAddressInfo.address)));
};

const legacyPeginTestsHappyPath = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not simple legacy pegins. I consider these legacy pegins as border cases, as well as uncommon/complex legacy pegins, at least those ones sending multiple outputs to the fed, since there's no reason for wallet to do that.

That being said, I would add a prefix to this variable like uncommon/complex-LegacyPeginTests . wdyt?

@marcos-iov marcos-iov deleted the create-parameterized-tests-for-2wp-pegins branch October 8, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants