Skip to content

Versioning module has no tests: version negotiation and compatibility transforms are uncovered #1136

Description

@nanaf6203-bit

Versioning module has no tests: version negotiation and compatibility transforms are uncovered

Labels / Complexity: testing · Medium Complexity — Medium

Problem

src/versioning/ (12 files, 0 *.spec.ts) implements the API versioning machinery every versioned endpoint depends on — header negotiation, deprecation warnings, and backward-compatibility.service.ts's per-version response transforms. None of it is pinned by tests: a regression that mis-negotiates a version or drops a compatibility transform ships silently, serving wrong-shaped responses to older clients.

Why this is architecturally hard

  1. Transform logic is the test design. Compatibility transforms reshape responses per version; tests need fixtures showing the same payload through each version boundary.
  2. Header negotiation is cross-cutting. Version-header parsing must be exercised through HTTP-level tests to cover missing, invalid, and conflicting version headers.

Acceptance criteria

  • Tests cover version-header parsing (valid, missing, invalid), deprecation warnings, and at least one compatibility transform.
  • Tests run in CI via npm test.
  • The PR reports the module's coverage change (npm run test:cov).

Out of scope

Changing versioning behavior; the @ts-nocheck migration for the module (tracked separately).

Getting started

  • src/versioning/backward-compatibility.service.ts — the transforms
  • src/versioning/version-header.interceptor.ts — the negotiation

Commands: npm test, npm run test:cov.

Good first files to read: src/versioning/backward-compatibility.service.ts, src/versioning/version-header.interceptor.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