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

Leeson 9 - Timeout Error for doing Unit test(Raffle.test.js) #6149

Open
kds93419 opened this issue Sep 21, 2023 Discussed in #6148 · 1 comment
Open

Leeson 9 - Timeout Error for doing Unit test(Raffle.test.js) #6149

kds93419 opened this issue Sep 21, 2023 Discussed in #6148 · 1 comment

Comments

@kds93419
Copy link

kds93419 commented Sep 21, 2023

Discussed in #6148

Originally posted by kds93419 September 21, 2023
Plz help me... i'cant find my mistake. i'm willing to test it(it("picks a winner, resets the lottery, and sends money")) but make a error(timeout)...

I've been struggling for several days.
image

https://github.com/kds93419/FCC-Lottery.git
here is my repo..thx

@MariossoKN
Copy link

So after adding a try catch to your test file I found that the problem is that the "performUpkeep" function returns a "Raffle_UpkeepNotNeeded(30000000000000000, 3, 0)" error.

error_upkeepNeeded

The error is caused by the: bool timePassed = ((block.timestamp - s_lastTimeStamp) > i_interval); check inside of the checkUpkeep function - the i_interval set inside of the cunstructor is greater then the actual timestamp - the timestamps set in constructor.

The only way I found to make this code work was to decrease the "keepersUpdateInterval" inside of the helper-hardhat file from 30 seconds to like 2-3 seconds. But I am not sure how is it possible that the code from Patrick works with 30 seconds without increasing the time with evm_increaseTime.

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

No branches or pull requests

2 participants