-
Hello community👋, I have come across an error and I'm not sure how to debug it as my and Patrick's code is same. The error says: My FundMe.test.js file: const { deployments, ethers, getNamedAccounts } = require('hardhat');
const { assert, expect } = require('chai');
describe('FundMe', async function () {
let fundMe;
let mockV3Aggregator;
beforeEach(async function () {
// deploy our FundMe contract using Hardhat-deploy
const { deployer } = await getNamedAccounts();
await deployments.fixture(['all']);
fundMe = await ethers.getContract('FundMe', deployer);
mockV3Aggregator = await ethers.getContract('MockV3Aggregator', deployer);
});
describe('constructor', async () => {
it('Sets the aggregator address correctly', async function () {
const response = await fundMe.priceFeed();
assert.equal(response, mockV3Aggregator.address);
});
});
describe('fund', async function () {
it("Fails if you don't send enough ETH", async function () {
await expect(fundMe.fund()).to.be.revertedWith(
'You need to spend more ETH'
);
});
});
}); The screenshot of Error: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
your error message in your contract might be different then what was expected In other words: most likely the error message in your contract is while in your test you have revertedWth:
|
Beta Was this translation helpful? Give feedback.
your error message in your contract might be different then what was expected
In other words:
most likely the error message in your contract is
Didn't send enough
while in your test you have revertedWth:
You need to spend more ETH