← スキル一覧に戻る

test-suite-generator
by deancochran
⭐ 1🍴 0📅 2026年1月22日
SKILL.md
name: test-suite-generator description: Generates comprehensive test suites for components, hooks, and utilities with proper mocking and assertions.
Test Suite Generator Skill
When to Use
- User needs tests for a new component
- User wants to add tests for utility functions
- User needs integration tests for API routes
- User asks to set up testing patterns
What This Skill Does
- Determines appropriate test types (unit, integration, e2e)
- Sets up test files with proper structure
- Creates mocks for dependencies
- Writes comprehensive test cases
- Adds edge case coverage
Component Testing Pattern
import { render, screen, fireEvent } from '@testing-library/react-native';
import { ActivityCard } from './ActivityCard';
import type { Activity } from '@repo/core';
describe('ActivityCard', () => {
const mockActivity: Activity = {
id: '1',
name: 'Morning Run',
type: 'run',
distance: 5000,
duration: 1800,
startTime: new Date(),
};
it('renders activity name and stats', () => {
render(<ActivityCard activity={mockActivity} />);
expect(screen.getByText('Morning Run')).toBeTruthy();
expect(screen.getByText('5.00 km')).toBeTruthy();
expect(screen.getByText('30:00')).toBeTruthy();
});
it('calls onPress when pressed', () => {
const onPress = jest.fn();
render(<ActivityCard activity={mockActivity} onPress={onPress} />);
fireEvent.press(screen.getByRole('button'));
expect(onPress).toHaveBeenCalledWith('1');
});
});
Hook Testing Pattern
import { renderHook, waitFor } from "@testing-library/react-native";
import { useActivityRecorder } from "./useActivityRecorder";
describe("useActivityRecorder", () => {
it("starts in ready state", () => {
const { result } = renderHook(() => useActivityRecorder("running"));
expect(result.current.state).toBe("ready");
});
it("transitions to recording when started", async () => {
const { result } = renderHook(() => useActivityRecorder("running"));
act(() => {
result.current.start();
});
await waitFor(() => {
expect(result.current.state).toBe("recording");
});
});
});
Utility Function Testing
import { calculateTSS } from "./calculations";
describe("calculateTSS", () => {
it("calculates TSS correctly for 1 hour at FTP", () => {
const tss = calculateTSS({
normalizedPower: 250,
duration: 3600,
ftp: 250,
});
expect(tss).toBe(100);
});
it("returns 0 for zero duration", () => {
const tss = calculateTSS({
normalizedPower: 250,
duration: 0,
ftp: 250,
});
expect(tss).toBe(0);
});
});
Test Coverage Requirements
- Happy path tests
- Edge cases (null, undefined, empty)
- Error conditions
- Boundary values
- Async operations
- User interactions
スコア
総合スコア
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
レビュー
💬
レビュー機能は近日公開予定です