Skip to content

Shorten the API test-tier filename suffixes #965

Description

@FSM1

Problem

The API test files carry two orthogonal qualifiers before .test.ts, which reads as redundant at a glance:

apps/api/src/registry/registry.http.integration.test.ts
apps/api/src/registry/services/registry.service.integration.test.ts
apps/api/src/republisher/services/record-cache.service.integration.test.ts

Four dot-segments before the extension is a mouthful, and http + integration together invite the reading "is it an integration test or an HTTP e2e test?"

The qualifiers are load-bearing, so a naive rename breaks things

They encode two independent axes:

  • integration is the tier — real Postgres via src/testing/integration-db.ts, versus a plain *.test.ts unit test against fakes.
  • http versus service is the entry point — supertest through the booted Nest app, versus calling the service class directly.

registry has both variants, so the qualifier genuinely disambiguates and cannot simply be dropped. Current inventory on main: 6 *.http.integration.test.ts and 5 *.service.integration.test.ts.

Neither tier is e2e. They boot the app in-process; nothing is deployed. The real e2e tiers are tests/web-e2e, sdk-e2e and desktop e2e.

Proposal

Collapse the tier suffix while keeping the entry-point axis:

registry.http.itest.ts
registry.service.itest.ts

Same information, one fewer segment. Open to alternatives — the goal is shorter, not this exact spelling.

The actual risk: tier selection is glob-driven

Which suite a file lands in is decided purely by its filename, in three configs:

  • apps/api/vitest.config.tsinclude: ['src/**/*.test.ts'], and explicitly excludes src/**/*.integration.test.ts
  • apps/api/vitest.integration.config.tsinclude: ['src/**/*.integration.test.ts']
  • apps/api/vitest.scheduled.config.tsinclude: ['src/**/*.scheduled.test.ts']

A rename to *.itest.ts matches neither the unit include nor the integration include. Get the config half wrong and the files silently stop running — green CI, zero coverage. This repo has already been bitten by exactly this shape: the web package's vitest include matches *.test.ts only, so *.spec.ts files were silently skipped in CI.

Required guard: record the executed test count from the API Integration - real Postgres CI job before and after, and assert it is unchanged. Do the same for the unit job. An identical-or-higher count is the only acceptable outcome; a drop means files fell out of a glob.

Scope

  • Rename the 11 files
  • Update the include/exclude globs in the three apps/api/vitest.*.config.ts files
  • Grep for any other reference to the old suffixes: .github/workflows/ci.yml, apps/api/package.json scripts, blueprint/testing.md suite map, and any docs naming the file pattern
  • Verify executed test counts are unchanged in both the unit and integration gates

Pure rename plus config. No test bodies change.

Depends on

Part of #655

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp:apiapps/api — NestJS residual surface, registry, mailbox, republishercomp:ciCI gates, workflows, test/perf harnessv2-buildv2 rewrite build slice

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions