← スキル一覧に戻る

test-generation
by vneseyoungster
ChocoVine turns "Vibes Coding" into Engineering. It stops hallucinations by enforcing a strict Research → Test → Code loop.
⭐ 23🍴 17📅 2026年1月23日
SKILL.md
name: test-generation description: Generate comprehensive tests following project testing patterns. Use after implementing features.
Test Generation Skill
Purpose
Create consistent, comprehensive tests.
Test Patterns
Unit Test Pattern
Reference: patterns/unit-tests.md
describe('[Unit Under Test]', () => {
describe('[method/function]', () => {
it('should [expected behavior] when [condition]', () => {
// Arrange
const input = ...;
const expected = ...;
// Act
const result = functionUnderTest(input);
// Assert
expect(result).toEqual(expected);
});
it('should throw [error] when [invalid condition]', () => {
// Arrange
const invalidInput = ...;
// Act & Assert
expect(() => functionUnderTest(invalidInput))
.toThrow(ExpectedError);
});
});
});
Integration Test Pattern
Reference: patterns/integration-tests.md
E2E Test Pattern
Reference: patterns/e2e-tests.md
Coverage Targets
| Type | Lines | Functions | Branches |
|---|---|---|---|
| Unit | 80% | 80% | 70% |
| Integration | 60% | 60% | 50% |
| E2E | Critical paths | - | - |
Test Naming Convention
[should/does] [expected behavior] [when/given] [condition]
Examples:
should return user when valid ID providedshould throw NotFoundError when user does not existshould disable button when form is invalid
What to Test
- Happy path (normal operation)
- Edge cases (boundaries)
- Error cases (exceptions)
- State transitions
Test Structure
AAA Pattern
// Arrange - set up test data and conditions
const input = createTestInput();
const mockService = createMock();
// Act - execute the code under test
const result = await functionUnderTest(input);
// Assert - verify the outcome
expect(result).toEqual(expectedOutput);
expect(mockService.method).toHaveBeenCalledWith(expectedArgs);
BDD Style
describe('User Service', () => {
describe('when creating a user', () => {
it('should save the user to the database', () => { });
it('should send a welcome email', () => { });
it('should return the created user', () => { });
});
describe('when the email is invalid', () => {
it('should throw a ValidationError', () => { });
});
});
Test Template
Use: templates/test-template.ts
Best Practices
Do
- Test behavior, not implementation
- Use descriptive test names
- Keep tests independent
- Use factories for test data
- Mock external dependencies
Don't
- Test private methods directly
- Share state between tests
- Use production data in tests
- Over-mock (test should be meaningful)
- Write flaky tests
Storage Location
Save test reports to: docs/reviews/test-report-{session}.md
スコア
総合スコア
70/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
レビュー
💬
レビュー機能は近日公開予定です
