Tell us what’s happening:
I had troubles with the task, so I had to seek for answers on the web, where I found the code that I’ve used as the base for the solution for the task. However, with recent changes, it seems like there are different requirements, I went along updating the code, however now the app would just crash on every ‘pass attempt’.
Here’s the code used:
You didn’t mention your errors generated in the repl.it console:
TypeError: Cannot read property '_id' of undefined
at /home/runner/boilerplate-project-exercisetracker/server.js:150:35
This is in your exercise posting route, which crashes your app and would cause subsequent failures. Examining the code in question:
_id: foundUser[0]._id,
indicates that you haven’t found that user, which means the id is not getting passed to the route like you think. So, add logging statements of the route inputs and responses and re-run the tests to make sure that the route is getting and sending the correct information.
Also, if you look at the browser console while running the tests, you’ll see a bunch of CORS errors. I’m not sure if those are real or are due to the app crashing, but you may need to check your CORS configuration as well.