Can't pass all 25+5 clock tests, although my app does everything it should

Hey, everyone!
First time posting here, I hope i’m not doing something wrong.
So, I’m doing the freecodecamp challenge of building a 25+5 clock. And I’m getting these error messages that I can’t even know what the real problema is, like:

  1. 25 + 5 clock has started but time displayed is not changing : expected 0 to be above 0
  2. AssertionError: 25 + 5 has started but time displayed is not changing: expected ‘00’ to not equal ‘00’
  3. Timer has not reached 00:00.

I already saw other responses to similar problems, but the issues people where having seems different. As I’ll explain bellow
My clock is changing the display, and my timer is reaching 00:00. It is also displaying the start number of the clock when it changes from a session clock to a break clock. And pausing and restarting, as it should.
My thoughts on this is that maybe my clock is displaying things correctly, but not in the time that the automated test expect it, causing the errors. And what is weird is that if I change the time in which I call my function that manages time to 100 ms instead of 1000 ms (I did that to run my own tests) I pass all the tests, but my clock runs faster. I already tried changing the clock to update every 100 ms but it didn’t work.
I’m also considering changing my time management from a stateful class to a function, maybe it will have a quicker response? (IDK)

So, my codepen is here: My 25+5 clock
I didn’t started styling it

Any help will be greatly appreciated! :smiley:

EDIT: I explain bellow how I managed to fix, hopefully it would be helpful to somebody.

Why does it show sixty thousand minutes?

Also, it’s hard to find the problem if you change the code while I check it :sweat_smile:

And also congratz, seems like your tests pass now.

Hey! @flaxi
Well, I was making my clock update every 100ms, so I have to change the increase/decrease time function.

And thanks for you being willing to help. But after having one Idea here I manage to fix the issue.

So, there was i little bit of delay in starting the chronometer because my function that decrease the timer was checking if the status of clock was in “running” or “stopped”. I managed to change that by making a ternary operator check that, and call the Heartbeat component immediately after the status change to running.

Thanks! Thank you for taking your time to look at my code also!

No problem. Wished I could have helped. Glad you figured it out on your own :smiley:
Also, as an added challenge I recommend you add a click sound for each second that passes.

That’s a good idea! I will either do that (and implement a button if somebody would want to silence the Tic) or make a visual effect happens every second like a spreading shadow or something. :smiley:

Either way, thanks!

Just pay attention to the click/alarm interaction. Might break your tests a little. :smiley:

I’ll keep an eye on that :grin:

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