Skip to content

Improve unit coverage and harden background/content-script flows#218

Merged
bartekplus merged 1 commit intomasterfrom
codex/coverage-and-tests
Feb 24, 2026
Merged

Improve unit coverage and harden background/content-script flows#218
bartekplus merged 1 commit intomasterfrom
codex/coverage-and-tests

Conversation

@bartekplus
Copy link
Owner

@bartekplus bartekplus commented Feb 24, 2026

Summary

This PR improves test depth and reliability across background/content-script flows, adds missing unit tests for uncovered modules, and includes minor correctness fixes discovered while increasing coverage.

Key Changes

  • Added focused unit suites for previously under-tested modules:
    • tests/error.test.ts
    • tests/variables.test.ts
    • tests/SpacingRulesHandler.test.ts
    • tests/TemplateExpander.test.ts
    • tests/TextExpansionManager.test.ts
    • tests/PresageEngine.test.ts
    • tests/Migration.test.ts
    • tests/utils.additional.test.ts
  • Added high-value routing/behavior tests for main orchestration files:
    • tests/background.routing.test.ts
    • tests/content_script.behavior.test.ts
  • Included related updates in existing tests:
    • tests/content_script.watchdog.test.ts
    • tests/utils.test.ts
    • tests/e2e/puppeteer-extension.test.ts
  • Source fixes:
    • src/background/SpacingRulesHandler.ts
      • Fix spacing behavior when trailing insertion is disabled but preceding space must still be removed.
    • src/background/background.ts
      • Fix async error handling for migrateToLocalStore(...) in onInstalled update flow (.catch(...) instead of sync try/catch).

Coverage Impact

  • Unit coverage significantly improved overall.
  • High line coverage was achieved for key orchestration files:
    • src/background/background.ts
    • src/content-script/content_script.ts

Validation

Executed successfully:

  • npm run check
  • npm test
  • npm test -- --coverage
  • npm run test:e2e

Notes

  • This PR intentionally includes all currently modified files from the working tree, per request.

@bartekplus bartekplus self-assigned this Feb 24, 2026
@bartekplus bartekplus merged commit d23d048 into master Feb 24, 2026
4 checks passed
@bartekplus bartekplus deleted the codex/coverage-and-tests branch February 24, 2026 18:59
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