Quality Assurance Projects Issue Tracker - PUT seems to work but tests are failing

My PUT method seems to be working, but the following built-in FCC tests are failing:
“You can send a PUT request to /api/issues/{projectname} with an _id and one or more fields to update. On success, the updated_on field should be updated, and returned should be { result: 'successfully updated', '_id': _id } .”

“When the PUT request sent to /api/issues/{projectname} does not include update fields, the return value is { error: 'no update field(s) sent', '_id': _id } . On any other error, the return value is { error: 'could not update', '_id': _id } .”

In the console output I see: “Error: expected 1637911588537 to be above 1637911588537”

But, when I look at my MongoDB, I see that on the issues with {issue_title:“Issue to be Updated”} the updated_on time is greater than the created_on time.

I also see: “Error: expected { Object (error, _id) } to deeply equal { Object (error, _id) }”

But, I have an assert.deepEqual for “Update an issue with an invalid _id” and it seems to be acting as expected.

I’m certain that my tests could be more thorough, but looking at the console output and my MongoDB, it is not clear to me why either of these are failing. Of course, I am not immune to overlooking typographical errors or making a mistake involving scope or promises, but I’ve been looking at this for quite some time and I would really appreciate a second set of eyes to point me in the right direction.

Your project link(s)

My current attempt: https://replit.com/@phillipbreland/boilerplate-project-issuetracker

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0

Challenge: Issue Tracker

Link to the challenge:

For the first issue I realized that the FCC test was getting the same values every time. I deleted my database and tried again and it passed! I am guessing that I made a schema change that was not reflected in the database, but I am not 100% certain because it seemed to be working just fine in my own tests.

For the second issue:

When the PUT request sent to /api/issues/{projectname} does not include update fields, the return value is { error: 'no update field(s) sent', '_id': _id } . On any other error, the return value is { error: 'could not update', '_id': _id } .

I was returning { error: 'could not update', '_id': _id } if the ID did not occur in the project provided in the URL, but here the prompt and test are asserting that we should check if update fields were sent or not before anything else. I changed the order of my checks and now this test passes.

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