LinkOff
LinkOff copied to clipboard
Add full test coverage and refactor to remove code smells before tackling feature backlog
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.jsandmessage.jsbefore 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, andfeed-keywords.jsagainst 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.jsandmessage.jsat 100%) - Mutation score: 82.6% overall
- CodeScene:
utils.js,feed.js,message.js,feed-keywords.jsall at 10/10 - CI running on every push via GitHub Actions