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

Use TypeOrm Custom Repository in NestJS

Loading

Reading Time: 5 minutes NestJS has out of box integration with TypeORM, a TypeScript and JavaScript ORM that has good support of PostgreSQL. The library offers decorators to model data types and entities and tools to generate migration scripts to update database schema; therefore, it is a popular choice to perform CRUD operations. TypeORM offers custom repository that allows … Read more