Lesson 7: I got a test problem #5267
Answered
by
AliusLeeOuO
AliusLeeOuO
asked this question in
Q&A
-
i am trying to use unit test, and write FundMe.test.ts, use
this is my FundMe.test.ts code. I think it is no typos. import { deployments, ethers, getNamedAccounts } from "hardhat"
import type { Contract } from "ethers";
import { describe, beforeEach } from "mocha"
import { assert } from "chai";
describe("FundMe",async () => {
let fundMe: Contract
let deployer: string
let mockV3Aggreator: Contract
beforeEach(async () => {
deployer = (await getNamedAccounts()).deployer
await deployments.fixture(["all"])
fundMe = await ethers.getContract("FundMe", deployer)
mockV3Aggreator = await ethers.getContract("MockV3Aggreator", deployer)
})
describe("contructor", async () => {
it("set the aggreator addresses correctly", async () => {
const response = await fundMe.priceFeed()
assert.equal(response, mockV3Aggreator.address)
})
})
}) I even copied Patrick's |
Beta Was this translation helpful? Give feedback.
Answered by
AliusLeeOuO
Apr 9, 2023
Replies: 1 comment 2 replies
-
i know what happened. In |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
AliusLeeOuO
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i know what happened. In
01-deploy-fund-me.ts
, when deploy fundMe, i setwaitConfirmations
to 5, in hardhat local, it will never have 5 block confirmations.in
deploy/01-deploy-fund-me.ts
await deploy function, remove waitConfirmations property.