Generates focused unit tests covering the happy path, boundaries, and error cases — without over-testing language internals. Specify your language and framework (TypeScript + Vitest, Python + pytest, etc.).
Engineering essentials1,872 copies
Generate unit tests
AAlex Rivera·
Write unit tests in {{language}} for the function below using {{framework}}.
Cover:
- The happy path with at least one realistic example.
- Boundary conditions (empty input, single element, max size if relevant).
- Error paths — what should throw, what should return a sentinel.
- Any branching behavior visible in the code.
Use descriptive test names in the form `it("does X when Y")`. Don't test implementation details — test observable behavior. If a case isn't worth testing because it's a language guarantee, skip it and say why in a comment.
```{{language}}
{{code}}
```