AssertionError: time-left is not formatted correctly: expected '25' to equal '60'

Tell us what’s happening:
Hello! I’m working on the pomodoro-clock and I keep getting this error:
time-left is not formatted correctly: expected '25' to equal '60' AssertionError: time-left is not formatted correctly: expected '25' to equal '60'
The codepen link is below:
https://codepen.io/Manish169/pen/qBOgyVX

Your code so far

Your browser information:

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

Challenge: Build a Pomodoro Clock

Link to the challenge:
https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-pomodoro-clock

1 Like

I was stuck on that failing test for quite a while, I eventually figured out that what the test is telling me was that pression the session increment/decrement buttons should update the time remaining display immediately if both these conditions are true: the clock is not currently running AND the timer is currently in ‘break’ mode/state. What all this means is that when you first load your app, if you press +/- on your session buttons, it will reflect in the display time right away, but when you hit play, you then cannot change length using same buttons.

2 Likes

Hello,
Did you find the solution to this problem?

This is very strange project, as I have all the required tasks and looks ok to work, however I can pass only 16 out of 29 tests.
The problem is, I don’t even understand what is required from me, one of the failing tests is the one you have described.
My code: MyClock

2 Likes

Just from testing:

  • if I stop the timer at for example 24:55 and then increment the session length, it jumps to 26:00 instead of 25:00
  • when the timer runs down, it takes about 3 seconds until the next session/break starts

I’m not sure if fixing those will make all tests pass, but I’d start there.

2 Likes

Thank you very much for the time you spent by reviewing it, appreciate it. Regarding the session length, I have checked their example codepen project, it is the same.
Regarding 3 seconds of sound playing, it also doesn’t have any problems, as it states that sound should play for >=1 second. Checked the test results, still the same 16 successful & 13 failed cases.
Once again, appreciate the time you spent reviewing it

True, I never realised that.

For this, I’m not sure. The audio should play for at least one second, but in their example, even though the audio is longer than one second, the clock of the next session/break starts running immediately.

However, the main problem is that you’ve got an error thrown in some cases. Once an error gets thrown, the tests can’t continue, which might lead to more tests failing. You can see the error if you run the tests while having the console open (button in the lower left corner). Or you can take a closer look at the error messages of the tests (not just the first line). Many of them complain about the same type error:

TypeError: event.target.parentElement.nextSibling is null

It’s coming from your increment/decrement handlers. If you fix that bug, a lot more tests should pass.

Unfortunately couldn’t find the error that you have stated above among my failed cases. Regarding the audio I have also taken it out, now it is beeping for 2 seconds but the timer doesn’t wait to switch to other state until the beep ends.

Not sure where you get your error messages from, but what I can see when I check your codepen is this:

1 Like

Thanks you very much, indeed this was a problem. It is very strange for me, because when I was running it on my machine and even in the codepen project it actually was working with the increment and decrement functions, although the event was indeed null and event.target.value couldn’t be any value that could satisfy the event.target…===“session” for example. Whatever, passed the parameters this time properly and now the project passes 22 test cases failing in 7.
The ones that are failing now have the error code that timer never reaches 0, however the timer definitely shows that it reaches 00:00. Will have a look at it.
Thanks you very much for your help!