# Vitest Unit & Integration Testing

> Unit and integration testing with Vitest for TypeScript functions, API route handlers, business logic calculations, and database mocks.

Canonical: https://www.agentickit.co/skills/testing-vitest
Last updated: 2026-11-18

## Key practices
- Co-locate test files alongside source files (*.test.ts or *.spec.ts)
- Mock external HTTP requests with Mock Service Worker (MSW)
- Test boundary edge cases (null inputs, expired tokens, network timeouts)
- Aim for 90%+ code coverage on core domain business calculations

## Related
- [test-automator](https://www.agentickit.co/agents/test-automator)
- [debugger](https://www.agentickit.co/agents/debugger)
- [/ship](https://www.agentickit.co/commands/ship)
- [/fix](https://www.agentickit.co/commands/fix)
