-
At 11:18:04 of this course while running the unit test I am facing an error : FundMe
constructor
1) "before each" hook for "sets the aggregator addresses correctly"
0 passing (40s)
1 failing
1) FundMe
"before each" hook for "sets the aggregator addresses correctly":
Error: Timeout of 40000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/bones/vs-code/pat-col-tut/hardhat-fund-me-fcc/test/unit/FundMe.test.js)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
error Command failed with exit code 1. Here's my FundMe.test.js file code: const { assert } = require("chai")
const { deployments, ethers, getNamedAccounts } = require("hardhat")
describe("FundMe" , function(){
let fundMe
let deployer
let mockV3Aggregator
beforeEach(async ()=> {
//deploy our fundMe contract using hardhat-deploy
deployer = (await getNamedAccounts()).deployer
// const accounts = await ethers.getSigners()
// const accountZero = accounts[0]
//above 2 are also ways of getting account or deployer
await deployments.fixture(["all"])
fundMe = await ethers.getContract("FundMe" , deployer)
mockV3Aggregator = await ethers.getContract("MockV3Aggregator" , deployer)
});
describe("constructor" , function() {
it("sets the aggregator addresses correctly" , async ()=> {
const response = await fundMe.getpriceFeed()
assert.equal(response,mockV3Aggregator.address)
})
})
}) I tried using this.timeout(180000); before the it statement but that didn't help. I also tried adding mocha:{
timeout:120000,
} in hardhat.config.js file but even that didn't help out and Timeout of 180000ms exceeded was shown in the error. Please solve this issue. P.S. I am using the same versions of dev dependencies given in github repo |
Beta Was this translation helpful? Give feedback.
Answered by
b0nesss
Jul 5, 2023
Replies: 1 comment 2 replies
-
check for this const response = await fundMe.getPriceFeed() |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nvm got it
There was actually some error in deploy part where I had fixed no. of block confirmations as 6 for both localhost and sepolia and I didn't deploy in localhost during that part so never got this error. But in testing it was waiting for 6 block confirmations in localhost which won't happen and hence those timeouts.