What problem does it solve?
This Skill provides a comprehensive guide and practical examples for writing high-quality unit tests for TypeScript/NestJS projects using Jest. It covers everything from basic setup to advanced debugging and optimization techniques, ensuring your code is robust and maintainable.
Core Features & Use Cases
- Test Structure & Conventions: Follows AAA pattern, uses
target for SUT, and DeepMocked for type-safe mocks.
- Component-Specific Guidance: Provides tailored advice for testing services, controllers, guards, pipes, and repositories.
- Debugging & Optimization: Offers systematic approaches to fix failing tests and improve test suite performance.
- Use Case: A developer needs to write unit tests for a new NestJS service. They can use this Skill to generate the test file structure, plan test cases (happy path, edge cases, errors), implement the tests following best practices, and ensure mock interactions are correctly verified.
Quick Start
Use the typescript-unit-testing skill to write tests for the UserService class.