Error: Timeout of 500000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. #5936
Unanswered
LeoFranklin015
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
const { assert, expect } = require("chai"); const { getNamedAccounts, ethers, network } = require("hardhat"); const { developmentChains } = require("../../helper-hardhat-config"); developmentChains.includes(network.name) ? describe.skip : describe("Raffle Staging Tests", function () { let raffle, raffleEntranceFee, deployer; beforeEach(async function () { deployer = (await getNamedAccounts()).deployer; raffle = await ethers.getContract("Raffle", deployer); raffleEntranceFee = await raffle.getEntranceFee(); }); describe("fulfillRandomWords", function () { it("works with live Chainlink Keepers and Chainlink VRF, we get a random winner", async function () { // enter the raffle console.log("Setting up test..."); const startingTimeStamp = await raffle.getLastTimeStamp(); const accounts = await ethers.getSigners(); console.log("Setting up Listener..."); await new Promise(async (resolve, reject) => { // setup listener before we enter the raffle // Just in case the blockchain moves REALLY fast raffle.once("WinnerPicked", async () => { 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); resolve(); } catch (error) { console.log(error); reject(error); } }); // Then entering the raffle console.log("Entering Raffle..."); const tx = await raffle.enterRaffle({ value: raffleEntranceFee }); await tx.wait(1); console.log("Ok, time to wait..."); const winnerStartingBalance = await accounts[0].getBalance(); // and this code WONT complete until our listener has finished listening! }); }); }); });this is my staging testing and when I try to run this test . I get this error
my contract is
Beta Was this translation helpful? Give feedback.
All reactions