Skip to content

Improve test coverage to 95.3% - #9

Merged
jgordijn merged 3 commits into
mainfrom
test-coverage
Mar 4, 2026
Merged

jgordijn merged 3 commits into
mainfrom
test-coverage

Conversation

@jgordijn

@jgordijn jgordijn commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Summary

Comprehensive test coverage improvements across all packages:

Coverage Results

Package Before After
AI 96.4% 98.0%
Engine 91.1% 92.9%
Routes 100% 100%
Total ~90.7% 95.3%

What Changed

  • Engine package: Added error path tests for scheduler, fetcher, fragment, RSS, and scraper modules. Used collection deletion technique to trigger DB error paths. Added lifecycle tests for scheduler Start/Stop.
  • AI package: Added error path tests for preference regeneration, profile saving, and correction counting.
  • Routes package: Maintained 100% coverage with existing tests.
  • UI tests: 32 tests passing across auth-store, markdown, theme, and StarRating modules using vitest with jsdom environment.

Key Decision

Browser.go functions (defaultBrowserExtract, launchBrowser, openStealthPage, waitForContent) require a real Chrome browser and are accepted as integration-test-only code. They are mocked in all other tests via BrowserExtractFunc/BrowserFetchBodyFunc override variables. See decisions-2026-03-01-test-coverage.log.

jgordijn added 3 commits March 1, 2026 10:10
- Engine package: 91.1% → 92.9%
  - Added error path tests for scheduler, fetcher, fragment, rss, scraper
  - Added DB error tests via collection deletion
  - Added lifecycle test for scheduler Start/Stop
  - Added coverage for browser fallback error paths
  - Added tests for fragment dedup, similarity matching, and hash persistence

- AI package: 96.4% → 98.0%
  - Added error path tests for preference regeneration
  - Added tests for savePreferenceProfile collection missing
  - Added tests for countCorrectionsSinceLastProfile DB errors

- Routes package: 100% (maintained)

- UI tests: 32 tests passing (auth-store, markdown, theme, StarRating)

- Decision log: browser.go functions requiring Chrome are accepted as
  integration-test-only code, mocked via BrowserExtractFunc/BrowserFetchBodyFunc

Total coverage: 95.3% (target: ≥95%)
@jgordijn
jgordijn merged commit 99a8e58 into main Mar 4, 2026
1 check passed
@jgordijn
jgordijn deleted the test-coverage branch March 4, 2026 10:46
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