Skip to content

[Testing] env.ts validation has no tests for missing or malformed environment variables #845

Description

@RUKAYAT-CODER

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions