/test-gen
Genera tests cubriendo casos felices, bordes y errores.
Usage
/test-gen <file-path>
/test-gen <file-path>:<line> # específico a una función
/test-gen <file-path> --integration # tests con DB/network reales
Cobertura por default
Unit tests
- ✅ Caso feliz (input válido → output esperado)
- ✅ Inputs vacíos / null / undefined
- ✅ Inputs en el límite (rangos, longitudes)
- ✅ Inputs inválidos (debe throw o retornar error)
- ✅ Side effects (mocks de DB, fetch, etc.)
Integration tests
- ✅ Flujo completo end-to-end
- ✅ Con DB real (rollback al final)
- ✅ Con auth simulada
Frameworks soportados
Detecta automáticamente del package.json:
- Jest, Vitest, Mocha, AVA (Node)
- Pytest (Python)
- RSpec (Ruby)
- Go testing
- Playwright (E2E)
Convenciones
- Naming:
<file-bajo-test>.test.tso__tests__/ - Sigue el patrón existente del repo si hay tests previos
- Mock infraestructura externa, no la lógica del proyecto