Testing PATCH /todos/:id

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 ...

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.