testing-nestjs-applications
Installation
SKILL.md
Testing NestJS Applications
When to use
- Writing tests for use cases, controllers, or full HTTP flows
- Setting up test strategy for a NestJS feature
- Replacing mocks with hand-rolled fakes
Core rules
- Unit tests: domain entities with pure assertions (no NestJS testing module)
- Use-cases tested with hand-rolled fakes (not jest.mock)
- Integration tests:
Test.createTestingModulewith real or fake providers - E2E tests: Supertest against bootstrapped app
- No
jest.mockfor internal modules; only for third-party if needed
Reference shape (TypeScript)
Unit Test (Domain Entity)
import { User } from './user.entity';