Originally posted by **wbshobhit1** March 6, 2024
`const { assert } = require("chai");
const { getNamedAccounts, deployments, ethers } = require("hardhat");
describe("FundMe", async function () {
let fundMe;
let deployer;
let mockV3Aggregator;
beforeEach(async function () {
// const accounts = await ethers.getSigners();
// const accountZero = accounts[0];
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("should set the aggregator address correctly", async function () {
const response = await fundMe.priceFeed();
assert.equal(response, mockV3Aggregator.target);
});
});
});
`
I am getting this error "TypeError: ethers.getContract is not a function"
i have tried all the possible solution present on the StackOverflow and ethetruem stack solution no solution seems to work.
Discussed in https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/6483