Skip to content

test: restore skipped connectToDb tests#69

Merged
Bccorb merged 2 commits into
mainfrom
test/restore-skipped-db-jwks
Jul 7, 2026
Merged

test: restore skipped connectToDb tests#69
Bccorb merged 2 commits into
mainfrom
test/restore-skipped-db-jwks

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Addresses #14

Summary

  • tests/unit/db.spec.ts (connectToDb) was genuinely broken: the logger mock used ../src/utils/logger, but from tests/unit/ that resolves to tests/src (nonexistent), so the mock never applied and the log assertions failed. Corrected to ../../src/utils/logger and unskipped. Both the connect-success and connect-failure cases pass, and db.ts (previously 0% coverage) is now exercised.

Dev JWKS test stays skipped (with a reason)

I initially unskipped tests/integration/jwks/jwks.spec.ts (returns dev jwks) too, and it passed locally — but it fails in CI (404 instead of 200). Root cause: the dev branch of jwksHandler reads ./keys/dev/public.pem from disk, which exists in a local dev checkout but not in CI (keys/ is gitignored), and the fs/jose mocks don't reliably reach the handler because the app is built once in beforeAll, before the per-test resetModules/env stubbing. Re-enabling it needs harness rework (build the app per test, or exercise the dev branch without real key material). It's re-skipped with an inline comment explaining this.

Testing

db.spec.ts + jwks.spec.ts pass (dev JWKS test skipped). Typecheck + lint clean.

Note on CI

The verify / verify (cross-repo conformance) check fails on this PR, but it fails on every open PR including docs-only ones, so it is pre-existing and unrelated to this change (react harness "invalid URL" + adapter rate-limit 429s).

The connectToDb suite was skipped because its logger mock used the wrong
relative path (../src instead of ../../src from tests/unit), so the mock
never applied and the assertions failed. Fix the path and unskip; both
connect-success and connect-failure cases now pass, and db.ts (previously
0% coverage) is now exercised.

Leave the dev-mode JWKS test skipped with a documented reason: it depends
on ./keys/dev/public.pem (absent in CI) and on fs/jose mocks that do not
reliably reach the app built in beforeAll. Re-enabling it needs harness
rework, tracked in #14.

Addresses #14.
@Bccorb Bccorb force-pushed the test/restore-skipped-db-jwks branch from 842147a to 8f7efcd Compare July 7, 2026 00:50
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Bccorb Bccorb changed the title test: restore skipped connectToDb and dev JWKS tests test: restore skipped connectToDb tests Jul 7, 2026
@Bccorb Bccorb merged commit 768b0d2 into main Jul 7, 2026
2 of 3 checks passed
@Bccorb Bccorb deleted the test/restore-skipped-db-jwks branch July 7, 2026 19:38
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.

2 participants