Skip to content

Lesson 9: Assertion Error: + expected - actual #5676

Closed Answered by alfaqi
Jatinkkalra asked this question in Q&A
Discussion options

You must be logged in to vote

1- issue with BigNumber must toString() be out of add function, like this

assert.equal(
    winnerEndingBalance.toString(),
    winnerStartingBalance
      .add(
        lotteryEntranceFee
          .mul(additionalEntrants)
          .add(lotteryEntranceFee)
      )
      .toString()
  );

the issue of calculating the balance of winner was with closing } of for loop, , like this

for (
    let i = startingAccountIndex;
    i < startingAccountIndex + additionalEntrants;
    i++
  ) {
    const accountConnectedToLottery = lottery.connect(accounts[i]); // connecting to each account one by one
    await accountConnectedToLottery.enterLottery({
      value: lotteryEntranceFee,
    });
  }

then…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Jatinkkalra
Comment options

@Jatinkkalra
Comment options

@alfaqi
Comment options

Answer selected by Jatinkkalra
@Jatinkkalra
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants