25+5 Clock Unable to find 2 fails

Hello everyone. I am currently having an issue with the tests on the Pomodoro calculator. Everything they ask works perfectly fine to me but tests 1 and 8 from the Timer section do not work for some reason.
This is the Codepen link for testing the source code:
Pomodoro

Thanks, guys :smiley:

These both look like extra render errors where the state is one off from the display and it only matters when you test (usually).

For instance, for the first failing test, try logging session and min from the reset function and your timer. You’ll notice the display is one off from the logged values. When you simulate the test by running it and then resetting, you’ll get some output like:

session: 25
min: 1492
reset
session: 25
min: 1491
session: 25
min: 1500

You’ve got an extra tick after the reset.

So you may need to check the timer logic and you may need to be more careful with your state setting. Lots of specific logging may help as well.

Personally, I would recommend reducing the amount of state you have as time can be computed from min at any time and is not really state.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.