PatrickAlphaC / hardhat-fund-me-fcc

83 stars 184 forks source link

Staging test not exiting #6

Closed ghost closed 2 years ago

ghost commented 2 years ago

yarn hardhat test --network rinkeby when i checked the etherscan everything seems to be fine, but my tests are not ending, i also tried console.logging the endingBalance it does return me zero which is correct but the tests are not ending.

const { assert } = require("chai")
const { getNamedAccounts, ethers, network } = require("hardhat")
const { developmentChain } = require("../../helper-hardhat-config")

developmentChain.includes(network.name)? describe.skip
: describe("FundMe", async function () {
      let fundMe
      let deployer
      const sendValue = ethers.utils.parseEther("1")

      beforeEach(async function () {
          deployer = (await getNamedAccounts()).deployer
          fundMe = await ethers.getContract("FundMe", deployer)
      })

      it("allows people to fund and withdraw", async function () {
          await fundMe.fund({ value: sendValue })
          await fundMe.withdraw()
          const endingBalance = await fundMe.provider.getBalance(
              fundMe.address
          )
          assert.equal(endingBalance.toString(), "0")
      })
  })
rodriguesnavil commented 2 years ago

@shkarfz I spend my whole day resolving the same issue. It seems like there is some issue with the Rinkeby RPC URL provided by Alchemy. Try changing it to a different provider (Eg Moralis) and it should work fine without any issues.

PatrickAlphaC commented 2 years ago

So strange... does switching RPCs work for you too?

uzair011 commented 2 years ago

@shkarfz did you solve the issue??

I getting this INSUFFICIENT_FUNDS error and I have enough test eth on my Metamask wallet. this is my error. how to solve this?

Screenshot 2022-06-18 at 9 42 20 PM
ghost commented 2 years ago

I also ran through same issue and Switching RPC also worked for me. But how these things works under the hood.

PatrickAlphaC commented 2 years ago

Closing for now.

It's usually just due to a bad RPC connection.