Back End Development and APIs Projects - Exercise Tracker

Hi, The test script must have a bug, as my app is generating the correct output.
It fails one test all of the time:
Failed: The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added. Below are two responses from the POST /api/users/:_id/exercises which show the correct response format

{“_id”:“642c566a5d2f359649622bc8”,“username”:“jake”,“description”:“test1”,“duration”:“2”,“date”:“Mon Jul 11 2022”}
{“_id”:“642c566a5d2f359649622bc8”,“username”:“jake”,“description”:“test2”,“duration”:“2”,“date”:“Tue Apr 04 2023”}

Also the below test Passed this time, but it can fail depending on what time of day I run the test.
Passed: The date property of any object in the log array that is returned from GET /api/users/:_id/logs should be a string. Use the dateString format of the Date API.
Example Output from my app: {“description”:“test”,“duration”:60,“date”:“Tue Apr 04 2023”}

Link to my Repl: boilerplate-project-exercisetracker - Replit

Thanks.
Austin

Your project link(s)

solution: boilerplate-project-exercisetracker - Replit

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

Your data type for duration is not correct.

Example response

{
  username: "fcc_test",
  description: "test",
  duration: 60,
  date: "Mon Jan 01 1990",
  _id: "5fb5853f734231456ccb3b05"
}

Your response

{
  _id: '642dbb8ca5e3033c2c7cda8c',
  username: 'fcc_test_16807187315',
  description: 'test',
  duration: '60',
  date: 'Mon Jan 01 1990',
}

Thank you very much, lasjorg. That indeed was the issue for that test. I fixed it and completed the assignment.
Just curious to know why the second last test fails in the evening EST, and passes in the first half of the day. There may be some issue with the time zone?
Anyway, I’m moving on to the next assignment.
Thanks again.

I’m not sure if it is a time zone issue. But there are diffidently issues with daylight savings and running the tests close to midnight.

I am having this exact same issue, what is your timezone and what time did you pass the test?

All I know is you should do the test as far away from midnight as possible (+/- 3 hours should be fine).


Also, without seeing your code we can’t be sure what the problem is. You should open your own thread and post a link to the code or Replit.

Hi,
I’m in New York, EST, which was UTC -4 at the time I got mine to work.
I passed the test by running earlier in the day. Any time before 6pm +/- worked for me.
Good luck.

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