Hi, I’m having issues passing those three test that you can see in the picture. I linked my codepen. I build the project in local and then I uploaded to codepen, I get the same three errors.
I tested the errors myself but I get the result that the test want, so I don’t understand what’s wrong.
I think is a problem with the setInterval(), cause when I set it to 10ms I pass all the test, but when I set it to 1000ms I keep failing the tests in the pic.
It will take at least 1 second for initial run. so when you click on the play button the display time is at 25:00. when this run initially the timer is 1500 meaning 25 minutes.So for the next second also the display time is 25:00. As you can see there is 1second delay.
To avoid this you can try this
let timer = this.state.timer-1
then it will fail another test which is when the session end the new timer you are setting is breaklength *60. Consider breaklength as 5 minutes so 5 * 60 = 300. and on the next run of interval we are decreasing timer by one at the top. So it will be 299 meaning 4:59. So the clock will never reach 5:00. You can avoid this by