Back to list
AlvaroVFon

unit-test-generator

by AlvaroVFon

0🍴 0📅 Jan 11, 2026

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

  1. Identify the target: Determine which file needs tests (e.g., src/feature/feature.service.ts).
  2. Create the spec file: Create a file named feature.service.spec.ts in the same directory.
  3. Apply standard patterns: Use the project's established mocking and testing patterns.
    • See patterns.md for detailed code patterns and examples.
  4. 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.
  5. Verify isolation: Ensure jest.clearAllMocks() is used in afterEach to prevent test contamination.

Principles

  • Mock Dependencies: Do not use real databases or external services. Mock all injected providers.
  • Consistent naming: Follow the describe('ClassName', ...) and describe('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)

Score

Total Score

50/100

Based on repository quality metrics

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

Reviews

💬

Reviews coming soon