nestjs-testing
Installation
SKILL.md
NestJS Testing
Priority: P2 (MAINTENANCE)
Structure
src/**/*.spec.ts # Unit tests (isolated logic)
test/**/*.e2e-spec.ts # E2E tests (full app flows)
Unit Testing
- Setup: Use
Test.createTestingModule()with mocked providers - Mocks: Mock all dependencies via
{ provide: X, useValue: mockX } - Pattern: AAA (Arrange-Act-Assert)
- Cleanup: Call
jest.clearAllMocks()inafterEach