Overview
env.ts validates environment variables at startup, but there are no automated tests for the validation logic. Missing or wrong variable types in CI environments are discovered only when the app crashes on start.
Specifications
Features:
- Write unit tests for: all required vars present (valid), one var missing (throws), wrong format (throws), optional var missing (no throw)
- Add CI check that fails if required vars are not set
Tasks:
- Create
__tests__/env.test.ts
- Mock
process.env for each test scenario
- Add GitHub Actions step that validates required env secrets
Impacted Files:
src/config/env.ts
__tests__/env.test.ts (new)
.github/workflows/
Acceptance Criteria
- All four test scenarios pass
- CI fails early if required env vars are missing
- Optional var absence does not throw
Overview
env.tsvalidates environment variables at startup, but there are no automated tests for the validation logic. Missing or wrong variable types in CI environments are discovered only when the app crashes on start.Specifications
Features:
Tasks:
__tests__/env.test.tsprocess.envfor each test scenarioImpacted Files:
src/config/env.ts__tests__/env.test.ts(new).github/workflows/Acceptance Criteria