Lesson 7 - FundMe.test.js - Cannot read properties of undefined (reading 'getContract') #2112
-
I have just started the testing section, and I was getting some errors so I copy/pasted Patrick's code from the repository. But now I am getting a different error. Here is my FundMe.test.js file const { assert, expect } = require("chai")
const { network, deployments, ethers } = require("hardhat")
describe("FundMe", async function () {
let fundMe
let deployer
let mockV3Aggregator
beforeEach(async () => {
// const accounts = await ethers.getSigners()
// deployer = accounts[0]
deployer = (await getNamedAccounts()).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)
})
})
}) The error seems to be with the getContract function. When I run "yarn hardhat test"
The contracts were deployed successfully using "yarn hardhat deploy" Can anybody help with this. Did I miss something along the way? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
@alkali333 Push it to GitHub and leave a link here. |
Beta Was this translation helpful? Give feedback.
-
Delete the |
Beta Was this translation helpful? Give feedback.
@alkali333 Push it to GitHub and leave a link here.