Testing Infrastructure
Status: ✅ Complete
Last Updated: 2026-01-14
Overview
Complete testing infrastructure setup with test database, CI/CD enforcement, and comprehensive test utilities.
Implementation Details
Test Database Setup
- ✅ Separate test database (uses TEST_DATABASE_URL or separate test DB)
- ✅ Automatic cleanup between tests via
test-helpers.ts(cleanupTestUsers()) - ✅ Migration testing (migrations run in CI before tests)
- ✅ Seed data for tests (tests create their own data using test-helpers)
CI/CD Test Enforcement
- ✅ GitHub Actions CI pipeline (
.github/workflows/ci.yml) - ✅ Tests run on every PR (workflow triggers on push and PR)
- ✅ Coverage reports (generated and uploaded to Codecov)
- ✅ Block merge if tests fail (tests must pass - configure branch protection)
- ✅ Block merge if coverage drops (90% threshold enforced in vitest config)
Test Utilities
- ✅ Test database helpers (
test-helpers.tsprovides all utilities) - ✅ Mock factories (
createTestUser,createTestWeek,createTestDay) - ✅ Test data builders (
test-helpers.tsprovides builders) - ✅ Common test setup/teardown (
cleanupTestUsers()handles cleanup)
Files
server/src/test-helpers.ts- Shared test utilities.github/workflows/ci.yml- CI/CD pipeline configuration- Test configuration in
server/vitest.config.tsandweb/vitest.config.ts