All AI prompts
Coding & Dev
Generate unit tests for any function
Happy path, edge cases, and failure modes.
The prompt
Write comprehensive unit tests for the function below using [TEST FRAMEWORK — e.g. Vitest / Jest / Pytest]. Cover: happy path, boundary values, invalid inputs, and the top 3 failure modes. Use descriptive test names in the 'it should …' style. ``` [PASTE FUNCTION] ```
Paste it into ChatGPT, Claude, Gemini or Midjourney and replace anything in [SQUARE BRACKETS] with your own details.
Related prompts
More Coding & Dev prompts from the library.
- Coding & DevPerfect conventional commit messageFollows conventional-commits, with body and footer.
- Coding & DevExplain any code line-by-lineGreat for reading unfamiliar codebases.
- Coding & DevRefactor messy code with reasoningCleaner version with a diff-style rationale.
- Coding & DevDebug an error like a senior engineerRoot cause, fix, and prevention — not just a patch.