Making the assertions for the users call

One assertion we want to make is that the actual users array was updated, it should have been updated when we called this.users.push. I'm going to expect that by calling expect. We're going to expect something about users.users: the first user refers to the users variable and the second one actually accesses the users array as defined in users file. Then we're going to call toEqual. Remember for arrays and objects, you have to use toEqual as opposed to toBe. We're going to expect it to be an array with just one item. The item should look just like the user object we have defined in the code:

var resUser = users.addUser(user.id, user.name, user.room);expect(users.users).toEqual([user]);

If this passes, ...

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.