← スキル一覧に戻る

unit-test-generator
by AlvaroVFon
⭐ 0🍴 0📅 2026年1月11日
SKILL.md
name: unit-test-generator description: Automated unit test generation for new functionalities using Jest. This skill ensures that every new controller, service, or repository has corresponding unit tests following the project's mocking and structure patterns.
Unit Test Generator
This skill guides the creation of unit tests for new or modified features in the project.
Workflow
- Identify the target: Determine which file needs tests (e.g.,
src/feature/feature.service.ts). - Create the spec file: Create a file named
feature.service.spec.tsin the same directory. - Apply standard patterns: Use the project's established mocking and testing patterns.
- See patterns.md for detailed code patterns and examples.
- Cover success and error cases:
- Every public method should have at least one success test.
- Edge cases and potential exceptions (e.g.,
NotFoundException,ConflictException) should be tested.
- Verify isolation: Ensure
jest.clearAllMocks()is used inafterEachto prevent test contamination.
Principles
- Mock Dependencies: Do not use real databases or external services. Mock all injected providers.
- Consistent naming: Follow the
describe('ClassName', ...)anddescribe('methodName', ...)structure. - Minimal context: Keep tests focused on the logic of the unit, not integration details.
Quick Start Examples
Testing a Service
Testing a Repository (Mongoose)
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です