The next step is to make sure that the user's password will be encrypted when we store it on MongoDB. This process is really easy and only uses a new library, called bcrypt .
To use bcrypt, install it through npm:
$ npm install --save bcrypt
You also need to install the types:
$ npm install --save @types/bcrypt
Once you have installed bcrypt, as well as its types, change the 02_user.spec.ts file to create a new user on the before step, with the password encrypted:
...import * as bcrypt from 'bcrypt'... before(async () => { expect(UserModel.modelName).to.be.equal('User') UserModel.collection.drop() const newUser = new UserModel(user) newUser.password ...