LinkOff icon indicating copy to clipboard operation
LinkOff copied to clipboard

Add full test coverage and refactor to remove code smells before tackling feature backlog

Open dhansak79 opened this issue 5 months ago • 0 comments

Is your feature request related to a problem? Please describe. The core features (feed.js, message.js, utils.js) had no automated tests, making it risky to refactor or change behaviour — any regression would only be caught manually. Code health analysis (CodeScene) flagged multiple files with Bumpy Road and code duplication smells, and there was no CI to catch regressions on push.

Describe the solution you'd like

  • Add DOM test suites for feed.js and message.js before touching any logic, covering keyword filtering, post count prompts, stall detection, MutationObserver setup, and all guard conditions
  • Add Stryker mutation testing to validate test quality (not just line coverage)
  • Add a GitHub Actions CI workflow to run tests on every push and PR to main
  • Refactor utils.js, feed.js, message.js, and feed-keywords.js against the locked-in tests to eliminate code duplication and flatten complex functions
  • Target 10/10 CodeScene scores on all modified files

Additional context Results after the changes on this branch:

  • 123 tests passing across 6 test files
  • Line coverage: 92.2% overall (feed.js and message.js at 100%)
  • Mutation score: 82.6% overall
  • CodeScene: utils.js, feed.js, message.js, feed-keywords.js all at 10/10
  • CI running on every push via GitHub Actions

dhansak79 avatar Jun 10 '26 21:06 dhansak79