Error: call revert exception #1118
-
hi again, i am trying to run my test but i keep getting thie error this is my test // unit tests bas lal development chains
const { assert, expect } = require("chai")
const { getNamedAccounts, deployments, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../../helper-hardhat-config")
!developmentChains.includes(network.name)
? describe.skip
: describe("Raffle Unit Tests", async function () {
let raffle, vrfCoordinatorV2Mock
const chainId = network.config.chainId
beforeEach(async function () {
const { deployer } = await getNamedAccounts()
await deployments.fixture(["all"])
raffle = await ethers.getContractAt("Raffle", deployer)
vrfCoordinatorV2Mock = await ethers.getContractAt("VRFCoordinatorV2Mock", deployer)
})
describe("constructor", async function () {
it("Initializes the raffle correctly", async function () {
//ideallly we make our tests have 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"])
//bethot .to string eza its gna be a big number
})
})
describe("enterRaffle", async function () {
it("reverts when your don't pay enough", async function () {
await expect(raffle.enterRaffle()).to.be.revertedWith(
"Raffle__SendMoreToEnterRaffle"
)
})
})
}) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 24 replies
-
Could you send the Raffle contract - or a link to the repo. Either works. Thank you. EDIT: Try Ali's solution before doing this. |
Beta Was this translation helpful? Give feedback.
-
@chrismogab Use the getContract function instead of getContractAt. |
Beta Was this translation helpful? Give feedback.
@chrismogab Use the getContract function instead of getContractAt.