When I run yarn hardhat test I get below error:
1) "before each" hook for "sets the aggregator addresses correctly"
0 passing (1m)
1 failing
FundMe
"before each" hook for "sets the aggregator addresses correctly":
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/blockchain-javascript/hh-blockchain-js-solidity/hardhat-fund-me-fcc/test/unit/FundMe.test.js)
at listOnTimeout (node:internal/timers:564:17)
at processTimers (node:internal/timers:507:7)
I have tried following things:
- Changing timeout
- Adding done()
- Literally copy pasting patrick's code and it still does not work
- Tried removing async and added done
- Tried chatGPT :). gave the code to it asked for correction the suggestion it comes with is something which takes me to same state.
My code is below.
const { deployments, ethers, getNamedAccounts } = require("hardhat")
//const { getNamedAccounts } = require("@nomiclabs/hardhat-ethers/helpers") // Fixed typo here
const { assert } = require("chai")
describe("FundMe", async function() {
this.timeout(60000)
let fundMe
let deployer
let mockV3Aggregator
beforeEach(async function() {
deployer = (await getNamedAccounts()).deployer
await deployments.fixture(["all"])
fundMe = await ethers.getContract("FundMe", deployer)
mockV3Aggregator = await ethers.getContract("MockV3Aggregator", deployer)
})
describe("constructor", async function() {
it("sets the aggregator addresses correctly", async function(done) {
// Added async here
//this.timeout(60000)
const response = await fundMe.priceFeed()
assert.equal(response, mockV3Aggregator.address)
done();
})
})
})