[SOLVED] Not able to pass Test case 4-6

Tell us what’s happening:
Not sure what I am missing in the response format, but I can successfully add exercise to any user, retrieve logs and users

Working project:
Code: https://repl.it/@mandeep147/API-project-exercisetracker#server.js
Response by my app for add exercise Test case #4

"date":"Fri Oct 09 2020"

response by my app for /api/exercise/log/test

"log":[{"description":"test","duration":20,"date":"Fri Oct 09 2020"},{"description":"test","duration":20,"date":"Wed Nov 25 2020"}]

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36.

Challenge: Exercise Tracker

Link to the challenge:

I’m getting 400 in the console for the POST api/exercise/add route when I run the tests.

Can you try logging inside the conditionals and run the test to see which ones are triggering and why?

Oh, I see I was doing a find query on username instead of _id. Fixed the 400. I don’t see 400s now for the POST api/exercise/add route.
Still, test doesn’t pass

I get two 404 on the GET /api/exercise/log?userId= (you can open the browser dev tools and look at the Network tab when submitting).

Both give me a 404


I’m about to log off so sorry for not being able to help you more right now. Maybe someone else will chime in.

1 Like

thanks for pointing out. used req.param instead of query!> :woman_facepalming:

Still stuck at #4

Argh, I didn’t check the network tab on the app. Should have done that. I don’t see any failures now on any of the POST add.
Look at that needed to cast duration before sending response

Thanks for pointing out those errs I misunderstood in requirement