25 + 5 Clock Test Errors

Hello, fellow campers :sweat_smile:! I finished working all the user stories for the 25 + 5 Clock. It’s live here, and my repository is here. (Clone the repo to your machine if you’re interested in combing through the code).

However, I’m running into unexpected errors in the test suite. Only 24/29 tests pass. The ones that fail are:

  • Timer Test 8: " If the timer is running and I click the element with id=“start_stop”, the countdown should pause." The error says: “25 + 5 has started but time displayed is not changing: expected ‘59’ to not equal ‘59’”
  • Timer Tests 12 and 14, and Audio test 1: The error for each of these is: “Timer has not reached 00:00.”

I suppose all of the above are to do with setInterval not being perfectly accurate, JavaScript being single-threaded and all that. But I don’t know of a better solution.

  • Audio Test 2: " The audio element with id=“beep” must be 1 second or longer." The error: “Timeout of 2000ms exceeded.” Apparently, there is also a hint: “For async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves.” But I don’t get the point there. Here is my audio component at a glance.
const Beeper = ({trigger}) => {
  const audio = useMemo(() => new Audio("./assets/beep.wav"), [])

  useEffect(() => {
    audio.play()
    return () => {
      audio.pause()
      audio.currentTime = 0
    }
  }, [audio, trigger])

  return <audio src="./assets/beep.wav" id="beep"></audio>
}

Looking forward to your insights :pray:!

cool ui, good job :clap:

i noticed something about timer when it begins it starts from given session minute “e.g. 01:00” and then goes to “00:00” isnt it supposed to be “00:59” to “00:00”?

happy coding :slight_smile:

I don’t quite understand. Do you mean there is a delay?

scenario:
initial session time - 1 min

session timer shows “1:00” => “00:59” => …

what im saying is, is it supposed to start from “00:59 => 00:58 => …” ?

happy coding :slight_smile: