# Test Generator

> Generates test cases for functions and components. Use when writing tests or creating test suites.

- Skill: `tibsfox/test-generator` (Agent Skill)
- Install (CLI): `npx skillmds@latest add tibsfox/test-generator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tibsfox/test-generator/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Tibsfox (https://skillmd.com/u/tibsfox)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/tibsfox/test-generator

---

# Test Generation

## Structure (AAA Pattern)

```typescript
it('should [expected] when [condition]', () => {
  // Arrange — set up data
  // Act — perform operation
  // Assert — verify outcome
});
```

## Test Categories

| Category | Test For |
|----------|----------|
| Happy path | Valid input → expected output |
| Edge cases | Empty, null, boundary values |
| Error cases | Invalid input, failures |
| Side effects | State changes, calls made |
| Async | Resolve/reject paths |

## Naming

Pattern: `should [behavior] when [condition]`

## Organization

- Group with `describe` by function/method
- Reset state in `beforeEach`
- One concept per test

## Anti-Patterns

| Don't | Do |
|-------|------|
| Test implementation | Test behavior |
| Share mutable state | Reset in beforeEach |
| Many assertions per test | One concept per test |
| Test private methods | Test through public API |
| Snapshot overuse | Assert specific values |

