Unit Testing
Unit tests focus on isolated logic such as utility classes, model methods, or service behavior without relying on full HTTP request flows.
Where to place unit tests
Use:
tests/Unit
Basic unit test pattern
You can use your preferred test runner syntax (vitest or bun:test) and still rely on your project code directly.
TypeScript
When to use TestCase in unit tests
If your unit test needs the container, config, or database connection from your app bootstrap, extend tests/TestCase.ts and run setup hooks:
TypeScript
Best practices
- keep each test focused on one behavior
- avoid HTTP calls in pure unit tests
- only boot the full app when unit tests require framework context
- use clear test names for failure readability
