AssertionError: Expected transaction to be reverted with You need to spend more ETH!, but other exception was thrown: Error: Transaction reverted: function returned an unexpected amount of data
I was getting this error when running test for fundMe() around 11:20:38 of the video
describe("FundMe", async function () {
let fundMe;
let deployer;
let MockV3Aggregator;
beforeEach(async function () {
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("sets the aggregator addresses 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!"
);
});
});
});
After some research it seemed that the issue could ber esolved by downloading @nomicslabs/hardhat-waffle from hardhat docs [https://hardhat.org/plugins/nomiclabs-hardhat-waffle]
But after running the install I now get the following error running the above test
1) FundMe
"before each" hook for "sets the aggregator addresses correctly":
TypeError: ethers.getContract is not a function
Any ideas of what could be the issue here? thank you!