Error when running listener test, says Error: Timeout of 500000ms exceeded. #1750
Answered
by
alymurtazamemon
Benrockiee
asked this question in
Q&A
-
When trying to run this staging test, i get a timeout Error..
This is the error i get
How do i get it fixed? |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Aug 14, 2022
Replies: 2 comments 1 reply
-
Try this //entering the raffle
console.log("Entering Raffle...")
const txResponse = await raffle.enterRaffle({ value: raffleEntranceFee })
const txReceipt = await txResponse.wait(6);
console.log("Time to wait...")
// emit accepts two parameters, 1st is contract, which will emit event, 2nd is event name in string form
expect(txReceipt).to.emit(raffle, "WinnerPicked"); // Expect the event to fire,
// Now the event is emitted, we can run our code to test for things after event is fired
console.log("WinnerPicked event fired")
try {
// add our asserts here
const recentWinner = await raffle.getRecentWinner();
const raffleState = await raffle.getRaffleState();
const winnerEndingBalance = await accounts[0].getBalance();
const endingTimeStamp = await raffle.getLastTimeStamp();
await expect(raffle.getPlayer(0)).to.be.reverted;
assert.equal(recentWinner.toString(), accounts[0].address);
assert.equal(raffleState, 0);
assert.equal(
winnerEndingBalance.toString(),
winnerStartingBalance.add(raffleEntranceFee).toString()
);
assert(endingTimeStamp > startingTimeStamp);
} catch (error) {
console.log(error);
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
@Benrockiee make sure to add mocha timeout like this: mocha: {
timeout: 500000,
}, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Benrockiee make sure to add mocha timeout like this: