Back to prompts
Write comprehensive unit tests for the following function: ``` [paste your function here] ``` Language / testing framework: [e.g. JavaScript with Jest / Python with pytest / Go testing package] What the function is supposed to do: [describe expected behaviour] Write tests covering: 1. Happy path — standard expected inputs and outputs 2. Edge cases — empty inputs, null/undefined, zero values, very large values 3. Error cases — invalid inputs, expected exceptions or error states 4. Boundary conditions — min/max values, exactly at limits For each test: - Use descriptive test names that explain what is being tested - Follow Arrange-Act-Assert (AAA) structure - Include inline comments explaining non-obvious test logic Also suggest 2–3 additional scenarios worth testing that I may have missed.
How to use this prompt
- 1Copy the prompt using the button above.
- 2Open your AI tool (ChatGPT, Claude, Midjourney, etc.)
- 3Paste and customize any variables in the prompt.
- 4Generate your result.