ISSUE IN CHAP-7 UNIT TESTING CODE #2402
-
Hey the code is when I'm doing yarn hardhat test --grep "amount funded" as shown in video I'm getting error |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Please share your entire code. Push it to github and leave a link here |
Beta Was this translation helpful? Give feedback.
-
@soumalya340 Make sure you have named accounts in the hardhat file namedAccounts: {
deployer: {
default: 0,
},
player: {
default: 1,
},
}, Also, the deployer is gotten like this: deployer = (await getNamedAccounts()).deployer; And getNamedAccounts is coming from hardhat: const { network, getNamedAccounts, deployments, ethers } = require("hardhat"); |
Beta Was this translation helpful? Give feedback.
-
The problem is, let fundMe
let deployer
let mockV3Aggregator
var Address
const SendValue = ethers.utils.parseEther("1") //helps to convert to ethers
beforeEach(async function () {
//deploy our fundme contract
//using Hardhat - deploy
// const accounts = await ethers.getSigners()
const deployer = (await getNamedAccounts()).deployer
await deployments.fixture(["all"])
fundMe = await ethers.getContract("FundMe", deployer)
mockV3Aggregator = await ethers.getContract(
"MockV3Aggregator",
deployer
)
}) here you declare the deployer 2 times on with this line |
Beta Was this translation helpful? Give feedback.
The problem is,
here you declare the deployer 2 times on with this line
let deployer
and later here…