Cannot deploy Unit Test for FundMe contract #5113
-
I am trying to deploy the Unit Test and it seems to work for the MockV3Aggregator, but not for my FundMe contract. The code in the video is different than the one in the repository, but either of them is working for me. When normally deploying the contracts in Sepolia or Local network I have no issues. But the testing is just throwing error. fundMe = await ethers.getContractAt("FundMe", deployer); I am using Which is an extract from the beforeEach: beforeEach(async () => {
const accounts = await ethers.getSigners();
deployer = (await getNamedAccounts()).deployer;
await deployments.fixture(["all"]);
fundMe = await ethers.getContractAt("FundMe", deployer);
mockV3Aggregator = await ethers.getContractAt(
"MockV3Aggregator",
deployer
);
}); When running "hardhat test" I get the following result:
I thought it was something with the method/property |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hope this format of discussion is good enough @PatrickAlphaC ;) |
Beta Was this translation helpful? Give feedback.
-
@isosatya npm install -D hardhat-deploy @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers and add this in you hardhat.configs.js file; require('hardhat-deploy'); |
Beta Was this translation helpful? Give feedback.
-
Hi guys, I tried all the steps that you suggested still getting errors. please help me i am stuck here form last 1 day. my test file
my pakage.json
errror
|
Beta Was this translation helpful? Give feedback.
@isosatya
getContractAt
is different thangetContract
.getContract
is not deprecated instead it is a function ofhardhat-deploy
. You need to install these;and add this in you hardhat.configs.js file;