PatrickAlphaC / hardhat-fund-me-fcc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FundMe.staging.test.js my code same as the sample, but it returns error

alexchenyu opened this issue · comments

FundMe.staging.test.js my codes are the same as the sample, but it returns an error:
Here is error reported:

yarn hardhat test --network goerli
yarn run v1.22.19
$ /home/alex/learn-web3/hh-fcc/hardhat-fund-me-fcc/node_modules/.bin/hardhat test --network goerli

  FundMe Staging Tests

    1) allows people to fund and withdraw

  FundMe
    constructor

      2) "before each" hook for "sets the aggregator addresses correctly"


  0 passing (1m)
  2 failing

  1) FundMe Staging Tests
       allows people to fund and withdraw:
     Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted", method="estimateGas", transaction={"from":"0x7CfCFe8Ae9B1cCCaEB40773c6c62090e3Ca15b67","to":"0xe7820F037Ba77209359e19F3A9a987616EC20A2B","data":"0x3ccfd60b","accessList":null}, error={"name":"ProviderError","_stack":"ProviderError: HttpProviderError\n    at HttpProvider.request (/home/alex/learn-web3/hh-fcc/hardhat-fund-me-fcc/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)\n    at LocalAccountsProvider.request (/home/alex/learn-web3/hh-fcc/hardhat-fund-me-fcc/node_modules/hardhat/src/internal/core/providers/accounts.ts:187:34)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at EthersProviderWrapper.send (/home/alex/learn-web3/hh-fcc/hardhat-fund-me-fcc/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)","code":3,"_isProviderError":true,"data":"0x579610db"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
      at Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at checkError (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:78:20)
      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:642:20)
      at step (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
      at Object.throw (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
      at rejected (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)

  2) FundMe
       "before each" hook for "sets the aggregator addresses correctly":
     Error: Timeout of 40000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/alex/learn-web3/hh-fcc/hardhat-fund-me-fcc/test/unit/FundMe.test.js)
      at listOnTimeout (node:internal/timers:564:17)
      at processTimers (node:internal/timers:507:7)



error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

And I check everything, don't know why? @PatrickAlphaC could you please help?

And for fund.js when the code is the same as the sample. It works. really strange