Lesson 9: Error while running Raffle__UpkeepNotNeeded while running Unit tests #768
-
I'm getting this error while running the unit tests for lesson 9, hardhat smart lottery:
This is my code: it("reverts if upkeep is not needed", async function () {
await expect(await raffle.performUpkeep("0x")).to.be.reverted My solidity code goes like: if (!upkeepNeeded) {
revert Raffle__UpkeepNotNeeded(
address(this).balance,
s_players.length,
uint256(s_raffleState)
); |
Beta Was this translation helpful? Give feedback.
Answered by
PatrickAlphaC
Jul 6, 2022
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
Great formatted question. Right now, you're running await raffle.performUpkeep("0x") We don't want it to do await expect(raffle.performUpkeep("0x")).to.be.reverted |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
PatrickAlphaC
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great formatted question. Right now, you're running
await
insideawait expect
, so you code is executing:We don't want it to do
await
forperformUpkeep
to finish, so we just remove theawait