Exercise tracker test not passing

Tell us what’s happening:
this test is not passing:
The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added.

this is what my code responds with:
{"_id":"61a26f3f6da21d00aa50afcb","username":"fcc_test_16380352625","__v":0,"date":"Sat Nov 27 2021","description":"asd","duration":45}

shouldn’t this be passing the test? the __v field caused me no issue /api/users tests so i don’t think that’s it

Your project link(s)

solution: https://replit.com/@federicopieruzz/boilerplate-project-exercisetracker

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Exercise Tracker

Link to the challenge:

1 Like

It doesn’t look like the date is handled correctly because when I submit and look at the response it’s always using the current date and not the one posted to the route.

You can look at the tests as well.

i fixed the date issue and the test is still not passing. i’m gonna look into what you suggested and see if i can find something usefull

The test is doing a deepEqual so I assume the extra property would make it fail (the versionKey property).

1 Like

yeah, that’s probably it. in the /api/users test there’s no deepEqual

it was indeed the __v key that was making the test fail. in case anyone encounters the same issue, you can disable the __v key adding the option {versionKey:false} to your schema