25 + 5 Clock issues

The test results in question are:
#25 + 5 Clock tests

passes:13 failures:16 duration:910.66
#Technology Stack
1. You can use any mix of HTML, JavaScript, CSS, Bootstrap, SASS, React, Redux, and jQuery to complete this project. You should use a frontend framework (like React for example) because this section is about learning frontend frameworks. Additional technologies not listed above are not recommended and using them is at your own risk. We are looking at supporting other frontend frameworks like Angular and Vue, but they are not currently supported. We will accept and try to fix all issue reports that use the suggested technology stack for this project. Happy coding!
#Content
1. I can see an element with id="break-label" that contains a string (e.g. “Break Length”).
2. I can see an element with id="session-label" that contains a string (e.g. "Session Length”).
3. I can see two clickable elements with corresponding IDs: id="break-decrement" and id="session-decrement".
4. I can see two clickable elements with corresponding IDs: id="break-increment" and id="session-increment".
5. I can see an element, with corresponding id="break-length", which by default (on load) displays a value of 5.
6. I can see an element, with corresponding id="session-length", which by default displays a value of 25.
7. I can see an element, with corresponding id="timer-label", that contains a string indicating a session is initialized (e.g. "Session").
8. I can see an element with corresponding id="time-left". NOTE: Paused or running, the value in this field should always be displayed in mm:ss format (i.e. 25:00).
time-left is not formatted correctly: expected '25' to equal '60'
AssertionError: time-left is not formatted correctly: expected '25' to equal '60'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:156387
    at l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79440)
    at Generator._invoke (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79193)
    at Generator.next (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79799)
    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)
9. I can see a clickable element with corresponding id="start_stop".
10. I can see a clickable element with corresponding id="reset".
#Timer
1. When I click the element with the id of "reset", any running timer should be stopped, the value within id="break-length" should return to 5, the value within id="session-length" should return to 25, and the element with id="time-left" should reset to it's default state.
Timer has not reached 00:00.
Error: Timer has not reached 00:00.
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:153156
2. 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 '4' to equal '1'
AssertionError: expected '4' to equal '1'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:158226)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259477
    at Dg.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259772)
    at Qg.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274680)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:275616
    at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274033)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274103
3. When I click the element with the id of "break-increment", the value within id="break-length" increments by a value of 1, and I can see the updated value.
expected '4' to equal '9'
AssertionError: expected '4' to equal '9'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:158604)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259477
    at Dg.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259772)
    at Qg.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274680)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:275616
    at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274033)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274103
4. When I click the element with the id of "session-decrement", the value within id="session-length" decrements by a value of 1, and I can see the updated value.
expected '25' to equal '21'
AssertionError: expected '25' to equal '21'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:158986)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259477
    at Dg.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259772)
    at Qg.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274680)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:275616
    at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274033)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274103
5. When I click the element with the id of "session-increment", the value within id="session-length" increments by a value of 1, and I can see the updated value.
expected '25' to equal '29'
AssertionError: expected '25' to equal '29'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:159358)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259477
    at Dg.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259772)
    at Qg.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274680)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:275616
    at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274033)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274103
6. I should not be able to set a session or break length to <= 0.
Value in element with id of "break-length" is less than 1.: expected '4' to equal '1'
AssertionError: Value in element with id of "break-length" is less than 1.: expected '4' to equal '1'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:159628)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259477
    at Dg.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259772)
    at Qg.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274680)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:275616
    at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274033)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274103
7. I should not be able to set a session or break length to > 60.
Value in element with id of "break-length" is greater than 60.: expected '3' to equal '60'
AssertionError: Value in element with id of "break-length" is greater than 60.: expected '3' to equal '60'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:160048)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259477
    at Dg.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259772)
    at Qg.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274680)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:275616
    at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274033)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274103
8. When I first click the element with id="start_stop", the timer should begin running from the value currently displayed in id="session-length", even if the value has been incremented or decremented from the original value of 25.
9. If the timer is running, the element with the id of "time-left" should display the remaining time in mm:ss format (decrementing by a value of 1 and updating the display every 1000ms).1938ms
10. If the timer is running and I click the element with id="start_stop", the countdown should pause.
25 + 5 clock has paused but time continued elapsing: expected '59' to equal '00'
AssertionError: 25 + 5 clock has paused but time continued elapsing: expected '59' to equal '00'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:161903)
    at l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79440)
    at Generator._invoke (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79193)
    at Generator.next (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79799)
    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)
11. If the timer is paused and I click the element with id="start_stop", the countdown should resume running from the point at which it was paused.
25 + 5 clock has paused but time continued elapsing: expected '59' to equal '00'
AssertionError: 25 + 5 clock has paused but time continued elapsing: expected '59' to equal '00'
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:1889)
    at Proxy.u (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:407:130)
    at n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:655)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:162654)
    at l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79440)
    at Generator._invoke (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79193)
    at Generator.next (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:79799)
    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)
12. When a session countdown reaches zero (NOTE: timer MUST reach 00:00), and a new countdown begins, the element with the id of "timer-label" should display a string indicating a break has begun.
Timer has not reached 00:00.
Error: Timer has not reached 00:00.
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:153156
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 not reached 00:00.
Error: Timer has not reached 00:00.
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:153156
14. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), and a new countdown begins, the element with the id of "timer-label" should display a string indicating a session has begun.
Timer has not reached 00:00.
Error: Timer has not reached 00:00.
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:153156
15. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), a new session countdown should begin, counting down from the value currently displayed in the id="session-length" element.
Timer has not reached 00:00.
Error: Timer has not reached 00:00.
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:153156
#Audio
1. When a countdown reaches zero (NOTE: timer MUST reach 00:00), a sound indicating that time is up should play. This should utilize an HTML5 <audio> tag and have a corresponding id="beep".
Timer has not reached 00:00.
Error: Timer has not reached 00:00.
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:153156
2. The audio element with id="beep" must be 1 second or longer.
3. The audio element with id of "beep" must stop playing and be rewound to the beginning when the element with the id of "reset" is clicked.
Audio element was not stopped when reset was clicked.: expected false to be true
AssertionError: Audio element was not stopped when reset was clicked.: expected false to be true
    at o.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:525:14996)
    at o.e (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:401:182)
    at Reflect.get (<anonymous>)
    at Object.e [as get] (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:68:1382)
    at n.isTrue (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:550:1222)
    at n.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:584:167951)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259477
    at Dg.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:259772)
    at Qg.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:274680)
    at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:569:275616

This is my Link
Another issue is that the beeping sound continues indefinitely.

Downgrade to React 17 or use the old ReactDOM.render method.

import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

It should work with ReactDOM.render but for some downgrading is necessary.

The app just broke when I tried the old ReactDOM and the downgrade did not fix anything (remember this is a vite, react and repl.it project, not a codepen one)

With React 17 you have to use ReactDOM.render and you need to adjust your code depending on how you import StrictMode.

import { StrictMode } from "react";
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
  <StrictMode>
    <App />
  </StrictMode>,
  document.getElementById('root')
);

Anyway, it is entirely possible that your code has bugs that have nothing to do with the incompatibility with the test and React 18. I never looked at the code.

I did just look briefly at it now and you likely want to clear the interval on reset and the handover logic from/to session/break doesn’t seem to work.

I’m not sure why you have elected to use the display strings for the time keeping instead of a numerical value. I would suggest having the timekeeping as a number and then format it to a display string as needed. For example, you can work in seconds and convert it to a time string.

Just as an example:

new Date(60 * 1000).toISOString().substring(14, 19)
'01:00'

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