Skip to content

Commit

Permalink
Using rest operator instead of shift on array.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-then committed Sep 18, 2024
1 parent d280986 commit 867470b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/tests/2wp.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ const execute = (description, getRskHost) => {

const finalRskRecipientBalances = await getFinalRskRecipientBalances(sendersInfo);

// Retrieving and removing the first rsk recipient balance since only the first sender should have the amount locked.
const firstRskRecipientBalance = finalRskRecipientBalances.shift();
// Extracting the first rsk recipient balance since only the first sender should have the total amount in rsk.
const [ firstRskRecipientBalance, ...restOfFinalRskRecipientBalances ] = finalRskRecipientBalances;
expect(Number(firstRskRecipientBalance)).to.be.equal(Number(btcToWeis(totalAmountToFed)));

// The other rsk recipients should have their balances unchanged
for(let i = 0; i < finalRskRecipientBalances.length; i++) {
const actualFinalBalance = Number(finalRskRecipientBalances[i]);
for(let i = 0; i < restOfFinalRskRecipientBalances.length; i++) {
const actualFinalBalance = Number(restOfFinalRskRecipientBalances[i]);
const expectedFinalBalance = 0;
expect(actualFinalBalance).to.be.equal(expectedFinalBalance);
}
Expand Down

0 comments on commit 867470b

Please sign in to comment.