Closed ChiragG2101 closed 2 years ago
Error:
1) FundMe fund Updated the amount funded data structure: Error: VM Exception while processing transaction: reverted with reason string 'Didn't send enough!'
The code used:
const { deployments, ethers, getNamedAccounts } = require("hardhat") const { assert, expect } = require("chai") describe("FundMe", async function() { let fundMe let deployer let mockV3Aggregator const sendValue = ethers.utils.parseEther("1") //1 ETH 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("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.reverted }) it("Updated the amount funded data structure", async function(){ await fundMe.fund({value: sendValue}) const response = await fundMe.addressToAmountFunded(deployer) assert.equal(response.toString(), sendValue.toString()) }) }) })
Can you ask in the full repo? Thanks! https://github.com/smartcontractkit/full-blockchain-solidity-course-js/
Error:
The code used: