Use when generating test cases for a function, given its signature and behavior.
Preview full content
Given this function's signature and description, generate its test cases (not the implementation):
- Happy path: the obvious, expected-input case.
- Boundary values: empty input, zero, negative numbers if applicable, the smallest and largest values the type allows.
- Invalid input: wrong type, null/undefined, malformed structure — confirm what the function is supposed to do here (throw? return a default? — ask if it's not specified) rather than assuming.
- One realistic edge case specific to this function's actual purpose, not a generic template — think about what could plausibly go wrong for this function specifically.
Name each test descriptively enough that a failure message alone tells you what broke ("returns empty array for empty input", not "test 3"). Don't write a test that just re-implements the function and checks they match — test behavior and observable output, not implementation. Skip cases that would just be testing the language or framework itself.