PatrickAlphaC / hardhat-fund-me-fcc

82 stars 183 forks source link

I am getting this error " AssertionError: Expected transaction to be reverted with You need to spend more ETH!, but other exception was thrown: Error: Transaction reverted: function call to a non-contract account" #100

Closed 0xSmolTrader closed 1 year ago

0xSmolTrader commented 1 year ago

const { inputToConfig } = require("@ethereum-waffle/compiler") const { assert,expect } = require("chai") const { ethers,deployments,getNamedAccounts } = require("hardhat")

describe("FundMe",async function(){

let fundMe
let deployer
let mockV3Aggregator
beforeEach(async function(){

  //const accounts = 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 dont send enough eth",async function(){

    await expect(fundMe.fund()).to.be.revertedWith(
        "You need to spend more ETH!"
    )
  })

})

})

0xSmolTrader commented 1 year ago

i already solved it, it was a problem with my priceconverter.sol file instead of me to put the variable "priceFeed" in the getPrice function i put an address