Skip to content

Config module has no tests: env validation and Swagger setup are uncovered #1128

Description

@nanaf6203-bit

Config module has no tests: env validation and Swagger setup are uncovered

Labels / Complexity: testing · Medium Complexity — Medium

Problem

src/config/ (6 files, 0 *.spec.ts) includes swagger.config.ts (the API docs setup), api-docs.controller.ts, and changelog.ts, and the repo's env validation lives in src/utils/validate-env.ts. None of this is covered by tests: a change that breaks Swagger generation or env validation ships silently, taking the API docs or boot-time checks down without CI noticing.

Why this is architecturally hard

  1. Env validation is boot-critical. validate-env.ts decides whether the app starts; tests must cover missing/invalid/valid combinations without actually booting the app.
  2. Swagger config is generated. Testing it means asserting on the generated document structure, which requires instantiating the module in a test harness.

Acceptance criteria

  • Unit tests cover validate-env.ts for valid, missing, and invalid env combinations.
  • Tests assert the Swagger document generates with the expected tags/version.
  • Tests run in CI via npm test.

Out of scope

The hardcoded version issue in api-docs.controller.ts (tracked separately).

Getting started

  • src/utils/validate-env.ts — the env validation
  • src/config/swagger.config.ts — the Swagger setup

Commands: npm test, npm run test:cov.

Good first files to read: src/utils/validate-env.ts, src/config/swagger.config.ts.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions