Create a Unit Test in NestJS with Mocks
Follow step-by-step instructions to create a unit test for UserService.
We'll cover the following
Implement a unit test for UserService
Now we’ve learned the basics of unit tests and Jest. In this lesson, we’ll explore how to implement unit tests for UserService
in our application using Jest.
Install the dependencies
Because we use NestJS CLI to generate the application, the Jest-related dependencies have been provisioned automatically. But when starting a new application without using the CLI generation, we need to have the following dependencies installed:
Get hands-on with 1400+ tech skills courses.