fix(backend): repair test suite broken by merge 5bbee35 (green CI) - #886
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repairs the backend test suite that a prior merge (
5bbee35) left broken, soCI (
npm run build+npm run test:cov) goes green again. Surfaced whilemerging the fix PRs #882–885 — the failures were pre-existing on
main, notintroduced by those PRs.
The build blockers (
CacheEntrytype,IsStringimport) already landed onmainvia #882; this PR fixes the tests.Changes
gists.service.spec— reconstruct the scrambled "non-23505" test that themerge mangled (undefined
err/writeArgs+ orphaned statements), and alignthe IPFS
pinJsonmock cid with the assertion.winston.config.ts— importDailyRotateFileviaimport = requireso itresolves without
esModuleInterop(the direct/side-effect import produceddefault is not a constructorunder the test's module mock).shutdown.service.spec— make thehttp.Servermock return the server(
close(): this), and align the timeout test withShutdownService'sdocumented 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 withit.todoso Jestdoesn't fail on an empty suite.
gist.repository.integration-spec.ts(renamed from.spec.ts) — this is aDB-backed integration test (Postgres+PostGIS). The unit CI has no database, so
it's renamed to the
-spec.tsconvention (excluded from the unittestRegex,same as the e2e suite) and given a
test:integrationnpm script. Run it with aDB available (e.g.
docker compose upthennpm run test:integration), or wirea DB-backed integration job in CI as a follow-up.
Verification
Local, matching the CI steps:
npm run build— passes.npm run test:cov— 12 suites pass, 86 passed + 1 todo, 0 failures.Closes nothing (no issue filed) — this is repair of pre-existing breakage from
merge
5bbee35.