Test failing, exercise tracker, backend cert

Tell us what’s happening:
The test “The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added.” is failing and I have no idea why. I have checked that the types of the returned object are correct with what is expected.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15

Challenge: Exercise Tracker

Link to the challenge:

hey @candrepa1 welcome to the FCC forum,
for the tests it would have been more helpful if you had provided the live working code on replit for easy debugging.

Logging your output from your POST route shows the problem:

{
  username: 'fcc_test_16404454204',
  description: 'test',
  duration: 60,
  date: '1990-01-02',
  _id: new ObjectId("61c735ec013eee9b22464bf2")
}

The date and _id fields are not to spec (although, only the date seems to be failing the test since the _id is probably coerced to a string at some point). Fixing the POST will then cause similar problems in the GET logs route too so you will need to log that output as well to find and fix the issue.

My bad! here it is: https://replit.com/@candrepa1/boilerplate-project-exercisetracker#server.js

Thank you for your answer. Indeed, you were right, I hadn’t formatted dates from input, just the empty input. Also, as you said, the test for the GET route is failing " 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." I changed the date format ton the POST request to be saved with the .toDateString format, and in the log route is displaying the correct formatting. I’m not sure if the test means that I have to use .toDateString specifically in the GET route, since I can’t think of anything else (both empty inputs and inputted dates are being formatted correctly)

haha for some reason it now works without any changes. thanks

Worked today. No changes to code. Must have either been a Replit glitch or somebody fixed the test.