Pomodoro clock works but tests fail?!

I have built the Pomodoro clock challenge using React. My attempt seems to follow all the user stories perfectly (apart from the audio, I still need to add that but this is fairly minor).

However, when I run the FCC tests, it fails multiple tests.

Here is my codepen link: https://codepen.io/rpollock03/pen/eYJmOLp?editors=1010

(I have not added much CSS as I want to get things working correctly before working on presentation)

Am I going about this the wrong way? I’d appreciate feedback if there is a better way to do this, or suggestions for improvement.

Thanks for your help.

Hello there,

When I hit reset during a countdown, the session seconds do not reset:

Hope this helps

1 Like

Thank you for your reply. The reset works perfectly for me :confused:
Would it be a browser compatibility issue? I see no reason in my code we the rest would work for me and not for you. Perhaps this is the issue causing the test to fail though.

Unfortunately, I cannot really help you with that. All I can easily notice is this:

if(breakActive==true || breakLength==59){

This - along with the session - prevents the length from being above 59, as apposed to the expected 60.

1 Like

that line prevents the user from increasing the break time if they are already in a break OR from increasing the break to 60 as per the user stories. It should have nothing to do with the reset or the timing function :confused:

I realise that. I am saying, you are failing some tests because:

I should not be able to set a session or break length to > 60.

60 is not > 60. So, I should be able to increase session and break length up to (including) 60.

Apologies I misunderstood. Thanks for flagging this I have corrected. Not sure why the reset button isn’t working for you. It works for me and the code is fairly simple. It’s still failing the test. I think it must have to do with how I’m using useEffect.

Have you tried developing outside of CodePen? The reset button seems to work sporadically, for me. So, I am wondering if it has to do with CodePen…

1 Like

Thanks, I’ll give it a try. I don’t really like codepen, but sortof have to use it for FCC projects :expressionless:

Remember, you do not have to use it for the projects. It is offered and recommended, because most users do not know how to set up a hosted preview of their webpage at this point, and CodePen skips the middle-man.

Personally, I think GitHub is an excellent way to go for all of your projects, as, if you are serious about furthering in web/software development, Git is almost a must. Plus, having all of your projects in one place is nice.

1 Like

Thank you, that’s good advice. I do use github and VSC normally but felt I needed to use this to get the certification, which I guess is not really all that necessary. I appreciate your comments and help with this. I think the basic approach is correct, and I’m using useEffect() etc correctly which I suppose is the main thing.