Lession 7 "Deployment chain is not defined" #1310
-
Hi guys, Before this my unit test works fine, now my unit test has the same problem. Even in my scripts, when I try to run Here are my codes below: const { assert } = require("chai")
const { network, ethers, getNamedAccounts } = require("hardhat")
const { developmentChains } = require("../../helper-hardhat-config")
developmentChains.includes(network.name)
? describe.skip
: describe("FundMe Staging Tests", async function () {
let deployer
let fundMe
const sendValue = ethers.utils.parseEther("0.1")
beforeEach(async () => {
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 endingFundMeBalance = await fundMe.provider.getBalance(
fundMe.address
)
console.log(
endingFundMeBalance.toString() +
" should equal 0, running assert equal..."
)
assert.equal(endingFundMeBalance.toString(), "0")
})
}) Here is my helper-config.js const networkConfig = {
31337: {
name: "localhost",
},
4: {
name: "rinkeby",
ethUsdPriceFeed: "0x8A753747A1Fa494EC906cE90E9f37563A8AF630e",
},
137: {
name: "polygon",
ethUsdPriceFeed: "0xF9680D99D6C9589e2a93a78A04A279e509205945",
},
}
const developmentChains = ["hardhat", "localhost"]
const DECIMALS = 8
const INITIAL_ANSWER = 200000000000
module.exports = {
networkConfig,
developmentChains,
DECIMALS,
INITIAL_ANSWER,
} Here is my Github link https://github.com/SakanaSachi/Hardhat-Fund-Me Thanks guys. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
|
Beta Was this translation helpful? Give feedback.
-
@SakanaSachi Add this: const { developmentChains } = require("../../helper-hardhat-config") Your unit test file has missed this. Also remove the from mock deploy file const { developmetChains } = require("../helper-hardhat-config") |
Beta Was this translation helpful? Give feedback.
@SakanaSachi
Add this:
Your unit test file has missed this.
Also remove the from mock deploy file