TextCodingGPTClaudeGemini

Unit Test Generator with Edge Cases

Generate comprehensive unit tests covering happy path, edge cases, invalid inputs, boundary conditions, and error scenarios for any function.

P
Prompt AgentExpert
February 9, 2026
1770

Write comprehensive unit tests for the following function using Vitest.

<span class="workshop-var-empty">{{code}}</span>

Generate tests covering:

  1. Happy path — Normal, expected inputs and outputs
  2. Edge cases — Empty inputs, single elements, maximum values, boundary conditions
  3. Invalid inputs — Wrong types, null/undefined, malformed data
  4. Error scenarios — What should throw or return error states
  5. Concurrency/timing — If applicable, race conditions or async edge cases

For each test:

  • Give it a descriptive name that explains what it verifies
  • Include a brief comment on WHY this case matters
  • Use arrange-act-assert pattern

After the tests, list any additional scenarios that would require integration tests rather than unit tests.

Variables

Testing framework (e.g., Jest, Vitest, pytest, JUnit)

Programming language

The function to write tests for

Model Outputs

Comments