Code
Write Unit Tests
Generate comprehensive test cases for a function.
Write unit tests for the following [LANGUAGE] function using [TESTING FRAMEWORK — e.g., Jest, pytest, JUnit]. Include tests for: (1) Normal/expected inputs, (2) Edge cases (empty inputs, large values, null/undefined), (3) Error cases (invalid inputs, boundary conditions). Each test should have a descriptive name that explains what it's testing. Add comments explaining the rationale for non-obvious test cases.
```
[PASTE FUNCTION]
```
testingunit testsquality
Want to use this with one click inside ChatGPT?
Get TresPrompt →