🧪

Test Suite Generator

Generate comprehensive tests for existing code

Intermediate🧪 TestingAll Models
prompt template
Write a comprehensive test suite for this code:

```
[PASTE_CODE_TO_TEST]
```

**Testing framework:** [jest / vitest / playwright — default to vitest]

Generate tests covering:
1. **Happy path** — normal expected usage (2-3 tests)
2. **Edge cases** — boundary values, empty inputs, large inputs
3. **Error cases** — invalid input, network failures, missing data
4. **Integration points** — mock external dependencies properly

For each test:
- Use descriptive test names that read like documentation ("should return empty array when no items match filter")
- Follow AAA pattern (Arrange, Act, Assert) with clear separation
- Use meaningful variable names (not foo/bar)
- Add a brief comment explaining WHY we test this case if it's not obvious

Also provide:
- Mock setup for any external dependencies
- A beforeEach/afterEach if shared setup is needed
- Total coverage assessment: what's tested, what's not, and why

Keep tests focused — one assertion per test when possible.

How to Use This Prompt

  1. 1Copy the prompt template above
  2. 2Paste into Claude, ChatGPT, or Cursor
  3. 3Replace [bracketed placeholders] with your specific project details
  4. 4Iterate on the AI output to refine and customize the results