Test fails saying date not in string form but it is

The test where the log array is retrieved is passing except for the test for date in string form. However, I used curl to do the request manually to see what is returned and the value is a string. Here is the curl command and response:

user@Users-MacBook-Pro ~ % curl https://boilerplate-project-exercisetracker.cavasian.repl.co/api/users/621db2e155979199c966f85c/logs

{“username”:“fcc_test_16461135052”,“count”:2,"_id":“621db2e155979199c966f85c”,“log”:[{“description”:“test”,“duration”:60,“date”:“Mon Jan 01 1990”},{“description”:“test”,“duration”:60,“date”:“Wed Jan 03 1990”}]}

Here are the test/results for the relevant tests:
You can make a GET request to /api/users/:_id/logs to retrieve a full exercise log of any user. - “Passed”

A request to a user’s log GET /api/users/:_id/logs returns a user object with a count property representing the number of exercises that belong to that user. - “Passed”

A GET request to /api/users/:id/logs will return the user object with a log array of all the exercises added. - “Passed”

Each item in the log array that is returned from GET /api/users/:id/logs is an object that should have a description , duration , and date properties. - “Passed”

The description property of any object in the log array that is returned from GET /api/users/:id/logs should be a string. - “Passed”

The duration property of any object in the log array that is returned from GET /api/users/:id/logs should be a number. - “Passed”

The date property of any object in the log array that is returned from GET /api/users/:id/logs should be a string. Use the dateString format of the Date API- “Failed”

Your project link(s)

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36

Challenge: Exercise Tracker

Link to the challenge:

Have you tried hitting the example service and seeing what it returns? Also, when you run the test, you can watch the dev tools network tab and see what is being sent and what the response is. You can do this for both the example project and yours and compare.

A good coder is a good debugger. And a good debugger is a good detective.

1 Like

Ah, thanks. I had been wishing there was a known working implementation I could test against and actually didn’t realize that there was since some of the other exercises pointed to things that weren’t actually working services as I recall. I used this service with my browser and the response only differed in the order in which id, name, count were given. I used the order specified in the exercise instructions but this was using a different order. When I switched my order of those properties then the test magically was happy with my date format which was already correct. So the instructions for the order of the properties to use for this get request were wrong and the test was order dependent and also resulted in an incorrect error message (which of course happens sometimes with stuff). Since it was order dependent for the first few properties they should have at least given the right order in the instructions instead of the wrong order. ugh. In any event, thanks for pointing out that there was a working service for this one. Very, very much appreciated!!! I never would have figured this one out without that.