Unit Test Custom Repository in NestJS

Loading

Reading Time: 5 minutes This is part 2 of Use TypeOrm Custom Repository in NestJS and this post is about unit testing custom repository. In part one, I created a NestJS demo with controllers, services and custom repositories. The demo also added unit testing on controllers and services in which I mocked the methods of custom repositories with jest.fn(). … Read more

Dependency injection by abstract class in NestJS

Loading

Reading Time: 3 minutes When developers start using NestJS, they create new module with controllers and services to design backend APIs. Developers register controllers and services in the module and inject service into controller to perform CRUD operations. Provider Registration The following is a code snippet of a user module; user controller is registered in controller array while user … Read more