LESSON 9: checkUpkeep test #5509
-
All the test till the "checkUpkeep test are working. when I test the code:
it give me the following error: Raffle unit test 0 passing (727ms)
However if I change line 58, that is: assert(!upkeepNeeded) to assert(upkeepNeeded) it works describe("checkUpkeep", function () { here you can see it works: C:\Users\K\hh-fcc\hardhat-smartcontract-lottary-fcc\node_modules.bin\hardhat test --grep "returns false if ppl haven't sent any ETH" Raffle unit test 1 passing (673ms) Done in 5.07s. Any explaination? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@cryptocambi Share all your test code. |
Beta Was this translation helpful? Give feedback.
-
@cryptocambi remove this line it("returns false if ppl haven't sent any ETH", async function () {
await raffle.enterRaffle({ value: raffleEntranceFee })
await network.provider.send("evm_increaseTime", [interval.toNumber() + 1])
await network.provider.send("evm_mine", [])
const { upkeepNeeded } = await raffle.callStatic.checkUpkeep([])
assert(!upkeepNeeded)
}) then it work . explanation for this answer right now you have this line isOpen true
timePassed true
hasPlayer true
hasBalance true
upkeepNeeded true and we want that isOpen true
timePassed true
hasPlayer false
hasBalance false
upkeepNeeded false for more reference you can check your |
Beta Was this translation helpful? Give feedback.
@cryptocambi remove this line
await raffle.enterRaffle({ value: raffleEntranceFee })
fromthen it work .
explanation for this answer
right now you have this line
await raffle.enterRaffle({ value: raffleEntranceFee })
in your code mean it is return this stuffisOpen true timePassed