Why aren't these tests passing in my 25+5 clock?

I’m building the 25+5 clock using React and I can’t figure out why 5 tests aren’t passing which are these

8. I can see an element with corresponding id=“time-left”. NOTE: Paused or running, the value in this field should always be displayed in mm:ss format (i.e. 25:00).

12. When a session countdown reaches zero (NOTE: timer MUST reach 00:00), and a new countdown begins, the element with the id of “timer-label” should display a string indicating a break has begun.

13. When a session countdown reaches zero (NOTE: timer MUST reach 00:00), a new break countdown should begin, counting down from the value currently displayed in the id=“break-length” element.

14. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), and a new countdown begins, the element with the id of “timer-label” should display a string indicating a session has begun.

15. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), a new session countdown should begin, counting down from the value currently displayed in the id=“session-length” element.

This is the link to my project, does anyone see the problem?

i find codepen environment is much more in tuned for this kinds of scenarios, thats just my take on this, hope you figure this our very soon if not already, happy learning :slight_smile:

time-left is not formatted correctly: expected ‘00’ to equal ‘60’

What do you see happen when you set the session to 60?


As an aside, I think StackBlitz/CodeSandbox is much better with React than Codepen. They give an actual editor with a proper dev environment.

1 Like

ok I fixed that problem, but the others are still failing even though they successfully switch times and the label changes to reflect if it’s a break or session. I even tried doing all lower case to show break or session and it still fails.

When I run the tests I don’t see the timer-label switch to Break.

If I set both timers to 1min and let the session timer run out it never switches to the break timer. The label doesn’t change to Break nor does a new countdown start.

1 Like

ok I fixed it, but I still have 1 test failing.

1. When a countdown reaches zero (NOTE: timer MUST reach 00:00), a sound indicating that time is up should play. This should utilize an HTML5

However when running it manually it seems to work perfectly fine.

It is caused by the setTimeout for the audio.

I would just remove it and let the audio play to completion. As long as it is a short-duration audio file it doesn’t need to be paused anyway.

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