Lesson 9 hardhat lottery => Raffle.test error #211
-
when I run: yarn hardhat test --grep "records players when they enter" I get this error :
code from Raffle.test const { inputToConfig } = require("@ethereum-waffle/compiler")
const { assert, expect } = require("chai")
const { getUnnamedAccounts, deployments, ethers, network } = require("hardhat")
const { developmentChains, networkConfig } = require("../../helper-hardhat-config")
!developmentChains.includes(network.name)
? describe.skip
: describe("Raffle Unit Tests", async function () {
let raffle, vrfCoordinatorV2Mock, raffleEntranceFee, deployer
const chainId = network.config.chainId
beforeEach(async function () {
deployer = (await getUnnamedAccounts()).deployer
await deployments.fixture(["all"])
raffle = await ethers.getContract("Raffle", deployer)
vrfCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock", deployer)
raffleEntranceFee = await raffle.getEntranceFee()
})
describe("constructor", async function () {
it("initializes the raffle correctly", async function () {
// Ideally we make our tests just 1 assert per "it"
const raffleState = await raffle.getRaffleState()
const interval = await raffle.getInterval()
assert.equal(raffleState.toString(), "0")
assert.equal(interval.toString(), networkConfig[chainId]["interval"])
})
})
describe("enterRaffle", async function () {
it("reverts when you don't pay enough", async function () {
await expect(raffle.enterRaffle()).to.be.revertedWith(
"Raffle__NotEnoughETHEntered"
)
})
it("records players when they enter", async function () {
await raffle.enterRaffle({ value: raffleEntranceFee })
const playerFromContract = await raffle.getPlayer(0)
assert.equal(playerFromContract, deployer)
})
})
}) |
Beta Was this translation helpful? Give feedback.
Answered by
PatrickAlphaC
Jun 9, 2022
Replies: 1 comment 3 replies
-
What is I think you mean Could you double check with the github repo code? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
dei8000
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is
getUnnamedAccounts
? And what isconst { inputToConfig } = require("@ethereum-waffle/compiler")
?I think you mean
getNamedAccounts
?Could you double check with the github repo code?