Exercise tracker: why doesnt pass?

I am facing this challenge: Exercise tracker.

This is the link to the replit in case anyone wants to take a look at the code.

I almost solved it, did a lot of testing and it seems to me that it works as expected.

But it does not pass one of the tests. The system returns the error:

You can POST to /api/exercise/add with form data userId=_id,
description, duration, and optionally date. If no date is supplied,
the current date will be used. The response returned will be the
user object with the exercise fields added.

My test is the following: in the exercise form I enter the following data:

userId: "6054708104932b014326fd7a" [a user created by me]
description: "Theory of Big Splat"
duration: 46
date: [nothing]

The application returns

{
  "userName": "Hiallow Fortenall", 
  "_ id": "6054708104932b014326fd7a", 
  "description": "Theory of Big Splat",
  "duration": "46",
  "date": "2021-03-19"
}

it seems to me that this is the result desired by the challenge.

How can it be that the test fails?

Duration should be number…

The error was that I used userName, while the challenge required username (!!!).

glad you figured that out !

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.