Skip to content

fix(backend): repair test suite broken by merge 5bbee35 (green CI) - #886

Merged
BigBen-7 merged 2 commits into
mainfrom
fix/backend-test-suite
Jul 23, 2026
Merged

fix(backend): repair test suite broken by merge 5bbee35 (green CI)#886
BigBen-7 merged 2 commits into
mainfrom
fix/backend-test-suite

Conversation

@BigBen-7

Copy link
Copy Markdown
Contributor

Summary

Repairs the backend test suite that a prior merge (5bbee35) left broken, so
CI (npm run build + npm run test:cov) goes green again. Surfaced while
merging the fix PRs #882–885 — the failures were pre-existing on main, not
introduced by those PRs.

The build blockers (CacheEntry type, IsString import) already landed on
main via #882; this PR fixes the tests.

Changes

  • gists.service.spec — reconstruct the scrambled "non-23505" test that the
    merge mangled (undefined err/writeArgs + orphaned statements), and align
    the IPFS pinJson mock cid with the assertion.
  • winston.config.ts — import DailyRotateFile via import = require so it
    resolves without esModuleInterop (the direct/side-effect import produced
    default is not a constructor under the test's module mock).
  • shutdown.service.spec — make the http.Server mock return the server
    (close(): this), and align the timeout test with ShutdownService's
    documented behavior: a drain timeout is a clean, bounded shutdown and
    still exit(0)s; only a thrown error suppresses the exit.
  • gist.e2e.spec — replace the empty placeholder with it.todo so Jest
    doesn't fail on an empty suite.
  • gist.repository.integration-spec.ts (renamed from .spec.ts) — this is a
    DB-backed integration test (Postgres+PostGIS). The unit CI has no database, so
    it's renamed to the -spec.ts convention (excluded from the unit testRegex,
    same as the e2e suite) and given a test:integration npm script. Run it with a
    DB available (e.g. docker compose up then npm run test:integration), or wire
    a DB-backed integration job in CI as a follow-up.

Verification

Local, matching the CI steps:

  • npm run build — passes.
  • npm run test:cov12 suites pass, 86 passed + 1 todo, 0 failures.

Closes nothing (no issue filed) — this is repair of pre-existing breakage from
merge 5bbee35.

BigBen-7 added 2 commits July 23, 2026 21:45
Fixes the backend test suite that a prior merge (5bbee35) left broken:
- gists.service.spec: reconstruct the scrambled non-23505 test, fix a
  writeArgs typo, and align the IPFS pinJson mock cid with the assertion
- gist.e2e.spec: replace the empty placeholder with it.todo so Jest does
  not fail on an empty suite
- gist.repository.spec: call countNearby with its 3 positional args
- shutdown.service.spec: make the http.Server mock return the server, and
  align the timeout test with ShutdownService's documented behavior (a
  drain timeout is a clean, bounded shutdown and still exits 0)
- winston.config.ts: import DailyRotateFile via import=require so it works
  without esModuleInterop (fixes 'default is not a constructor' under the
  test's module mock)

All unit suites pass. gist.repository.spec is an integration test that
requires Postgres+PostGIS and is handled separately.
gist.repository.spec is an integration test that requires Postgres+PostGIS,
which the backend-tests CI workflow does not provide. Rename it to
gist.repository.integration-spec.ts so the unit testRegex (.*\.spec\.ts$)
no longer picks it up — matching the existing -spec.ts convention used by
the e2e suite — and add a 'test:integration' script to run it against a
database (e.g. via docker-compose) or in a future DB-backed CI job.

Unit suite (npm run build && npm run test:cov) is now fully green.
@BigBen-7
BigBen-7 merged commit 493347b into main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant