Lesson 9. Unit testing: Error: Timeout of 200000ms exceeded. It("picks a winner, reset the lottery, and send money") #5406
Replies: 3 comments 1 reply
-
Hey, did you happen to find any answer to the error? |
Beta Was this translation helpful? Give feedback.
-
Error: Timeout of 400000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Hope this will help. |
Beta Was this translation helpful? Give feedback.
-
If you want I have the solution for ethers v6 but I suppose it's similar for ethers v5 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
.
Error
code
`
it("picks a winner, reset the lottery, and send money", async () => {
const additionalEntrants = 3
const startingAccountIndex = 1 // deployer = 0
const accounts = await ethers.getSigners()
for (let i = startingAccountIndex; i < startingAccountIndex + additionalEntrants; i++) {
const accountConnectedLottery = lottery.connect(accounts[i])
await accountConnectedLottery.enterLottery({ value: lotteryEntranceFee })
}
const startingTimeStamp = await lottery.getLatestTimeStamp()
// performUpkeep (mock being chainlink keeper)
// fulfilledRandomWords (mock being chainlink VRF)
// we will have to wait for fulfilledRandomWords to be called
await new Promise(async (resolve, reject) => {
lottery.once("winnerPicked", async () => {
console.log("Found the event!")
try {
const recentWinner = await lottery.getRecentWinner()
const lotteryState = await lottery.getLotteryState()
const endingTimeStamp = await lottery.getLatestTimeStamp()
const numPlayers = await lottery.getNumPlayers()
const winnerEndingBalance = await accounts[1].getBalance()
`
Beta Was this translation helpful? Give feedback.
All reactions