EasyFileMagic logo
Open a tool
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.