Thanks again, I feel like I’m doing exactly what you are suggesting, yet it still doesn’t pass.
I’m not sure what version of you code you debugged, but my latest version, looks like this for my .map loop:
let test = workingLog.map(item => {
return (
{
description: item.description,
duration: item.duration,
date: item.date.toDateString()
}
)
})
and my return
let exerciseLog = {
"username": user.username,
"_id": user._id,
"count": workingLog.length,
"log": test
}
console.log("exerciselog: ", exerciseLog);
res.status(201).json(exerciseLog);
And this is the output, yet it still isn’t passing. This is the last test. What does it look like i am missing? FWIW, I have also tried using JSON.parse() to get rid of the string notation of the keys, but I am getting an error with that. I’ve tried using res.send as well as res.json, and the result is the same both ways with the values in string notation.
I’m really stumped.
{
"username": "Archie",
"_id": "63d8884b25006df0edab6d03",
"count": 3,
"log": [
{
"description": "sleeping",
"duration": 56,
"date": "Sat Jan 01 2022"
},
{
"description": "running",
"duration": 120,
"date": "Sun Jan 02 2022"
},
{
"description": "barking",
"duration": 3,
"date": "Mon Jan 03 2022"
}
]
}
This is the test not passing:
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.
And the expected return:
{
username: "fcc_test",
count: 1,
_id: "5fb5853f734231456ccb3b05",
log: [{
description: "test",
duration: 60,
date: "Mon Jan 01 1990",
}]
}