In this section, we, well I guess more appropriately you, are going to be writing two test cases that verify patch
works as expected. We're going to take one Todo that's not completed and make it complete, and we'll take a second one that is complete and make it incomplete.
Now, in order to do that, we are going to need to tweak the seed data we have in our server.test
file. The seed data right in server.test
file is two Todo items; neither of them have the completed
property specified, which means it's going to default to false
. For the second item, we're going to go ahead and set it. We're going to set completed: true
and we're also going to set completedAt
equal to whatever value we want. You can choose any number at all. I'm going to go ahead and use 333
:
const todos = [{ _id: new ObjectID(), text: 'First test todo' },{ _id: new ObjectID(), text: 'Second test todo', completed: true, completedAt: 333 }];
Now we have two Todos that are going to let...