Issue with "25 + 5 Clock" tests suite

Hello everyone,
I am having a hard time understanding why my code doesn’t pass some tests on this project.
I have tests 12, 13, and 15 of the Timer section that are failing.
Tests 13 and 15 both display the following message :

Cannot read properties of null (reading '1')
TypeError: Cannot read properties of null (reading '1')
    at u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:148987)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:159626)
    at l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:79441)
    at Generator._invoke (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:79194)
    at Generator.next (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:79800)
    at r (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:1:1054)
    at s (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:1:1265)

My code is producing the expected behavior but the test seems to be unable to access an element and I couldn’t find which one based on the message provided.

Test 13 displays the following message :

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.
Timer has reached zero but didn't switch to Break time: expected 'Work' to not equal 'Work'
AssertionError: Timer has reached zero but didn't switch to Break time: expected 'Work' to not equal 'Work'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:549:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:431:130)
    at Function.n.notStrictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:574:736)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:160465)
    at l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:79441)
    at Generator._invoke (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:79194)
    at Generator.next (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:608:79800)
    at r (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:1:1054)
    at s (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:1:1265)

I can see the message switch as expected but it says it doesn’t. Maybe the test happens before the message is updated? I tried updating it earlier but it still doesn’t pass. I can’t tell why it doesn’t notice it

You can have a look at my code in this pen

Any help will be highly appreciated. Thanks in advance.

If you look closely, you can see that when the clock hits 00:00, the timer shows a negative number for a very short moment. Hardly noticable. But following from there, I deleted one character from your code, and that made all tests pass.

1 Like

I had not noticed that glitch. I fixed one condition and it is working. Thank you so much.

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