Https://eggplant-lizard-boot.glitch.me

Tell us what’s happening:
Test wont pass: Says I can add an exercise to any user by posting form data userId(_id), description, duration, and optionally date to /api/exercise/add. If no date supplied it will use current date. App will return the user object with the exercise fields added.

Your code so far

        app.post('/api/exercise/add', (req, res) => {
  const { userId, description, duration, date } = req.body;
  
  
  const dateObj = date === '' ? new Date() : new Date(date);
  
  const newExercise = {
    _id: userId,
    description,
    duration: +duration,
    date: dateObj.toDateString()
  }
  
  exercises.push(newExercise);
  
  return res.json(newExercise);
});

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:
https://eggplant-lizard-boot.glitch.me

Hello there,

The tests are expecting a username to be returned:

const expected = {
          username,
          description: 'test',
          duration: 60,
          _id,
          date: 'Mon Jan 01 1990'
        };

This is what you are returning:

{"_id":"123","description":"Running","duration":30,"date":"Thu May 14 2020"}

NOTE: There are known issues with many of the tests in the backend projects. These are being worked through, and we appreciate your patience.

Hope this helps

thanks for replying, let me try your suggestion