Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'waitForTransaction') #6270

Open
RashInTech opened this issue Nov 5, 2023 · 0 comments
Labels

Comments

@RashInTech
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant