Exercise Tracker fails test # 4

Project page - https://glitch.com/~exercise-tracker-fcc2
live page - https://exercise-tracker-fcc2.glitch.me

Seems like all working right, but failing test#4, adding an exercise. Saw others had issues in the past, one said setting id to _id fixes it but not for me.

Hello there,

Here is what the tests expected output is shaped:

const expected = {
  username: 'fcc_test_1596648410971', // Obviously the numbers change
  description: 'test',
  duration: 60,
  _id: 5f29cd9e782d5f13d127b456, // Must be of type 'ObjectId'
  date: 'Mon Jan 01 1990'
}

I walked another user through the tests here, if it helps: Exercise Tracker Project - Oddly Unfulfilled User Story

Specifically, users struggle with using an IdObject instead of just the id, as well as the variable types of the object.

edit: It does not look as though your /api/exercise/add returns anything, but the user story is:

App will return the user object with the exercise fields added.

Hope this helps

I add an exercise I get:
{"username":"mboucher012","description":"test","duration":44,"_id":"5f3f1f1a5b70ca04bb5708a6","date":"2020-08-21T01:18:49.056Z"}

My duration was a string, so changed it to a number using
Number(duration)
It looks like the same output as from the FCC example, except the date format is different. Would that cause it to fail?

Yes. Unfortunately, the date format has to be exactly the same as above. It should be as simple as:

const yourDate = date.toDateString();

Hope this helps

Up to the point I thought of it on my last update I was hoping it wasn’t something that simple and stupid lol . But that was it, you rock!! Thank you

1 Like