Test case – should remove a user

I'm going to make a variable userId to store the ideal ID, which would be 1, 2 or 3, I'll go with 1, then we can go ahead and actually remove it storing the return result in a user variable. I'm going to call users.removeUser passing in my userId variable, which is 1:

it('should remove a user', () => {  var userId = '1';  var user = users.removeUser(userId); });

Now that we have the potentially removed user we should be able to go ahead and assert some stuff. We're going to expect that the user object exists. We're also going to expect that its id equals the id we have up above, and expect that the user removed has an id property using toBe(userId):

it('should remove a user', () => {  var userId = '1'; var user ...

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.