Test: it can add a new user to the database

Hi I have a question,
delete user._id is necessary in this test? When i run this test i have result:

Expected value to equal:
{"_id": “5c6d01ebefcabd240de46ae3”, “email”: "magicz@cats.com", “name”: “Magical Mr. Mistoffelees”, “password”: “somehashedpw”}
Received:
{“email”: "magicz@cats.com", “name”: “Magical Mr. Mistoffelees”, “password”: “somehashedpw”}

if i comment this line test is ok

Read the other implemented code stubs within the commentsDAO and other DAO sections. There is something you are supposed to be doing with values that are an ObjectId which you are not doing. Hence the failure.

Also never edit the unit tests in the course material. The instructions tell you very clearly that the DAO sections are the only things you need edit, unless you are specifically directed otherwise by the question. If you edit a test, you may lead yourself to a false answer.

It is necessary as the _id of the user is used in the query to find the user to delete. As @neillunn pointed out, you shouldn’t edit the test cases. We’ve created them to give you an idea of what will be sent to the DAO methods from the API when the integration tests are run.

I’m really struggling with this one also. We are not given a “_id”, so the database should create one and return it. But I don’t understand why the test is failing. The user is added.

Actually this makes no sense to me. The expected is {"_id": "5c6d6f95ec4da30fff1a1683", "email": "magicz@cats.com", "name": "Magical Mr. Mistoffelees", "password": "somehashedpw"} but the automatically generated _id is never going to match the test case. Since it is random.

Basically, it looks like the test is not removing the _id as it should be. Since it is showing on the user object on the test.

Passes on the status page though once you have done all the requirements of this user management ticket (still fails in the tests).