full-blockchain-solidity-course-js
full-blockchain-solidity-course-js copied to clipboard
TypeError: Cannot read properties of undefined (reading 'waitForTransaction')
Lesson
Lesson 9
Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")
No response
Operating System
Windows
Describe the bug
const { assert, expect } = require("chai")
const { network, deployments, ethers, getNamedAccounts } = require("hardhat") const { developmentChains, networkConfig } = require("../../helper-hardhat-config")
!developmentChains.includes(network.name) ? describe.skip : describe("Raffle Unit Tests", function () { let raffle, VRFCoordinatorV2Mock, raffleEntranceFee, deployer const chainId = network.config.chainId beforeEach(async function () { deployer = (await getNamedAccounts()).deployer await deployments.fixture(["all"]) raffle = await ethers.getContract("Raffle", deployer) VRFCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock", deployer) raffleEntranceFee = await raffle.getEntranceFee() })
describe("constuctor", async function () {
it("initializes the raffle correctly", async function () {
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("Record when players enter", async function () {
await raffle.enterRaffle({ value: raffleEntranceFee })
const playerFromContract = await raffle.getPlayer(0)
assert.equal(playerFromContract, deployer)
})
it("emits an event on enter", async function () {
await expect(raffle.enterRaffle({ value: raffleEntranceFee })).to.emit(
raffle,
"raffleEnter",
)
})
})
})
I am getting TypeError: Cannot read properties of undefined (reading 'waitForTransaction') when emitting my event.Can anyone fix this?