BIT-15752: Add unit tests — 87 new tests, 95%+ coverage on writer-pipeline #7

Merged
spark merged 2 commits from test/BIT-15752-add-unit-tests into main 2026-05-06 12:17:29 +01:00
Owner

Summary

Resolves BIT-15752 — test-coverage-gap for BitReport.pt/news-platform.

What was added

87 new tests across three sub-packages using Node.js native test runner (node:test):

Package New tests Modules covered
writer-pipeline 29 token-metrics, store (canonicalUrl/itemId/upsertItem/shortlist), config-load
bridge 24 ranking (5 functions), aggregator-mapper
frontend/lib 34 format (5 fns), ui-i18n, public-origin

Coverage (writer-pipeline): 95.91% lines, 93.80% branches, 94.12% functions

Infrastructure

  • Added test:coverage scripts using node --experimental-test-coverage to writer-pipeline, bridge, and frontend
  • Added .gitea/workflows/test.yml CI pipeline running all three test suites on every push/PR

What remains (future work)

  • store.ts: loadStore/saveStore (file I/O, integration tests)
  • bridge/services/cache.ts: requires Redis mock
  • bridge/services/writer-config.ts: file-system integration
  • frontend Astro components: require Astro test harness
## Summary Resolves [BIT-15752](https://git.bitreport.pt) — test-coverage-gap for BitReport.pt/news-platform. ### What was added **87 new tests** across three sub-packages using Node.js native test runner (`node:test`): | Package | New tests | Modules covered | |---|---|---| | writer-pipeline | 29 | token-metrics, store (canonicalUrl/itemId/upsertItem/shortlist), config-load | | bridge | 24 | ranking (5 functions), aggregator-mapper | | frontend/lib | 34 | format (5 fns), ui-i18n, public-origin | **Coverage (writer-pipeline):** 95.91% lines, 93.80% branches, 94.12% functions ### Infrastructure - Added `test:coverage` scripts using `node --experimental-test-coverage` to writer-pipeline, bridge, and frontend - Added `.gitea/workflows/test.yml` CI pipeline running all three test suites on every push/PR ### What remains (future work) - `store.ts`: loadStore/saveStore (file I/O, integration tests) - `bridge/services/cache.ts`: requires Redis mock - `bridge/services/writer-config.ts`: file-system integration - `frontend` Astro components: require Astro test harness
spark added 1 commit 2026-04-29 02:08:59 +01:00
BIT-15752: Add unit tests across writer-pipeline, bridge, and frontend
Tests / writer-pipeline tests (push) Failing after 1s
Tests / bridge tests (push) Failing after 1s
Tests / frontend lib tests (push) Failing after 1s
Tests / writer-pipeline tests (pull_request) Successful in 52s
Tests / bridge tests (pull_request) Successful in 25s
Tests / frontend lib tests (pull_request) Successful in 29s
3d4b129b4c
87 new tests covering previously untested pure functions:
- writer-pipeline: token-metrics, store (canonicalUrl/itemId/upsertItem/shortlist), config-load
- bridge: ranking (freshness/relevance/rank/filter/take_top_n), aggregator-mapper
- frontend/lib: format, ui-i18n, public-origin

Adds test:coverage scripts (node --experimental-test-coverage) and Gitea
CI workflow. writer-pipeline now reports 95.91% line coverage.

Co-Authored-By: Paperclip <[email protected]>
spark scheduled this pull request to auto merge when all checks succeed 2026-04-30 10:33:22 +01:00
spark closed this pull request 2026-05-06 11:41:50 +01:00
spark reopened this pull request 2026-05-06 11:46:33 +01:00
paperclip-review-bot left a comment
Member

Approval via review bot per owner request.

Approval via review bot per owner request.
founding-engineer left a comment
Member

auto-approve: CI success (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success (gitea_auto_approve_open_prs_once.py)
devops-engineer left a comment
Member

auto-approve: CI success (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success (gitea_auto_approve_open_prs_once.py)
spark added 1 commit 2026-05-06 12:13:57 +01:00
chore(ci): retrigger checks for PR #7
Tests / writer-pipeline tests (push) Successful in 33s
Tests / bridge tests (push) Successful in 22s
Tests / frontend lib tests (push) Successful in 28s
Tests / writer-pipeline tests (pull_request) Successful in 21s
Tests / bridge tests (pull_request) Successful in 21s
Tests / frontend lib tests (pull_request) Successful in 27s
98a05fe946
spark merged commit 463184485f into main 2026-05-06 12:17:29 +01:00
Sign in to join this conversation.