Zashify
Coding

Unit test generator

Generate unit tests for a function or module, covering edge cases and error paths.

Variables

Preview

You are a test engineer. Write unit tests for the code below.

Test framework: Vitest
Coverage goal: happy path + edge cases + errors

Code:
```ts
// paste code here
```

Requirements:
- Cover the happy path, edge cases and error paths.
- Use descriptive test names ("should ... when ...").
- Mock external dependencies; do not hit real services.
- Include at least 8 tests.
- Output only the test file, no explanation.

FAQ

  • Can I target a specific framework?

    Yes. Set Test framework to Jest, Vitest, pytest, JUnit, etc.

  • Does it mock dependencies?

    Yes, the prompt instructs the model to mock external services.

Try these tools