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
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.
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.
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)