I’ve finally achieved to solve it after a lot of trial, error, research, reading and so on. A good tip that I can give you is to use setTimeout method instead of setInterval (well, it’s worked for me), depending on your code you may want to keep the reference to the asynchronous method you are using (timeout or interval) to clean it up later. Take a look at this topic, there’s a lot of good information - Pomodoro Clock: tests fail: Timer has not reached 00:00
I’m stuck at tests about increment or decrement by 1, I’ve tried couple of different approaches but I am always getting the same error in the tests like:
" When I click the element with the id of “break-decrement”, the value within id=“break-length” decrements by a value of 1, and I can see the updated value."
“expected ‘5’ to equal ‘1’”
I just would like to know what I’m doing wrong, since in manually tests everything seems to be ok, incrementing or decrementing session or break length.
I’m also stuck in other errors, but these about increment or decrement session and break length I couldn’t figure out what could be wrong. Others, I think that I have to parse more in deep the transition when the timeLeft reaches “00:00”
Here is my code, I’m using Redux state management and new React hooks, like useEffect, useState, useCallback:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.
Challenge: Build a 25 + 5 Clock
Link to the challenge: