CodeWithJay

NestJS Unit Testing with Jest: Mock PrismaService and Test JWT Auth e8

46 min1K views

NestJS Unit Testing with Jest: Mock PrismaService and Test JWT Auth e8

About this video

Everything we built last episode was verified by hand with Docker running. That does not scale, so this episode replaces all of it with a test suite that finishes in three seconds with nothing else started.

We wire Jest and ts-jest into the NestJS backend, build a testing module with Test.createTestingModule, swap PrismaService for a plain object made of jest.fn, and unit test the real AuthService.

Keep learning NestJS

Every free video, mini course and project-based course on NestJS in one place, in the order that makes sense.

All videos