25+5 Clock - failing tests 13 and 15

Hello!

My code is not passing tests 13 and 15.

This is the error message I’m getting for both about not starting with the correct value :

" Timer has switched to Break time, but it didn’t start with the correct value.: expected 0 to equal 5
AssertionError: Timer has switched to Break time, but it didn’t start with the correct value.: expected 0 to equal 5 "

Here is a link to my code: https://codepen.io/nocrustsandwich/pen/vYaYdOz?editors=1011

I understand why the code is not passing the tests but, I cannot seem to fix it.
The problem is that the “time-left” string does not seem to update even though I update it on the js file, line: 141.

Could someone with a bit more experience possibly give me a hint or two on why this is not working?

Thank you very much in advance.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: Front End Development Libraries Projects - Build a 25 + 5 Clock

Link to the challenge:

Run the timer manually with break and session set to 1 minute. At the change it should go from “00:01” to “00:00” to “01:00” but goes to “00:59” instead, hence the error about not starting from the currently displayed break time (“01:00”). Both test failures are likely the same thing.

You’ll need to determine what exactly is causing the problem, but it’s likely in how you format the time string or how you are updating the remaining time in the current session/break.

Thank you for responding!

Yeah, I’ve noticed that, that was the issue, but it seems that when I update the state that has the “time-left” string, it refuses to update even though I’m updating the “timer-label” string in the same line and in the same way and it is updating just fine.

I’m wondering if maybe, someone could help me understand why my method is not updating that particular state?

You’ll have to log the state controlling that (timeLeftSessionClock) everywhere you change it (several places). It should go to zero and then the equivalent of the new session time. You’ve got a lot of conditionals in those places and it’s possible you’ve accidentally not handled the zero to new session correctly.

Alright I’ll give that a go, and see if I can find the problem. :grin:

YOOOOOOOO!!! I’m so dumb :sweat_smile:

I had merely forgotten to add the “return;” at the end, which caused it to update the state twice .

My apologies, and thank you so much for your help jeremy, you’ve saved me from further headache. :sweat_smile: :laughing:

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