Exercise Tracker. Test #8 fails

Tell us what’s happening:
One test fails despite the response looks exactly as required.

The test that fails:
The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added.

Your project link(s)

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

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:

Hello there,

Nothing immediately jumps out that could be failing the test, but I do have a few comments on the code:

  1. Using global values for a multi-threaded environment does not work. The same goes for asynchronous calls (this could be why the tests are failing). This is why you are encouraged (and taught) to use a database
  2. It is confusing to send a status 200 with an error message: res.sendStatus(200).send("Invalid user id");
  3. Unless I missed it, you do not use the fr and to variables
  const fr = new Date(req.query.from).getDate();
  const to = new Date(req.query.to).getDate();

I hope you figure out how to move forward with the tests, and hope this helps.

Hi @gene_geist_90 ,
Did you manage to solve this? I have the same problem.