Lesson 7 : Unit test error - TypeError: no matching function (argument="key", value="getPriceFeed", code=INVALID_ARGUMENT, version=6.6.7) #5961
-
Hi all, from last one day I am facing this error and I tried every solutions given on online forum but still not resolve. Here is the full code - FundMe.test.js const { deployments, ethers, getNamedAccounts } = require("hardhat")
const { assert } = require("chai")
describe("FundMe", function () {
let fundMe
let deployer
let mockV3Aggregator
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer
await deployments.fixture(["all"])
fundMe = await ethers.getContractAt("FundMe", deployer)
mockV3Aggregator = await ethers.getContractAt(
"MockV3Aggregator",
deployer,
)
})
//constructor
describe("constructor", function () {
it("sets the aggregator addresses correctly", async () => {
const response = await fundMe.getPriceFeed()
assert.equal(response, mockV3Aggregator.address)
})
})
}) And In this function its showing error //constructor
describe("constructor", function () {
it("sets the aggregator addresses correctly", async () => {
const response = await fundMe.getPriceFeed()
assert.equal(response, mockV3Aggregator.address)
})
}) Can anyone help me on this? |
Beta Was this translation helpful? Give feedback.
Answered by
Nlferu
Aug 5, 2023
Replies: 1 comment 4 replies
-
Hello @kamalchakma1 Try downgrading your |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kamalchakma1
Then you have incorrectly downgraded
ethers
version. Ethers version 6 uses getAddress() function to retrieve the contract address, while the previous version 5 uses .address property. If you are still using ethers 6 (seems like you do) then replace.address
with.getAddress()
and it should fix your issue