Unit Test Generator Prompt
Prompt
Write unit tests for this function. [PASTE YOUR FUNCTION] Language/framework: [Python + pytest / JavaScript + Jest / TypeScript + Vitest] Please write tests covering: 1. Happy path: expected input/output 2. Edge cases: empty, null, boundary, large inputs 3. Error cases: invalid types, out-of-range, expected exceptions 4. Side effects: mock external calls For each test: - A descriptive test name - Arrange / Act / Assert structure - Comment explaining what failure would mean
Used by
Developers