Skip to content

test: raise coverage on under-tested modules#19

Merged
knep merged 6 commits into
masterfrom
test/coverage
Jun 18, 2026
Merged

test: raise coverage on under-tested modules#19
knep merged 6 commits into
masterfrom
test/coverage

Conversation

@knep

@knep knep commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

Adds unit tests for several previously under-tested modules and removes one untestable file from the coverage denominator. No production code changes — tests and one .coveragerc tweak only.

Module Before After
src/migrations/migrate.py 0% 91%
src/main.py 0% excluded (bootstrap/wiring)
web-src/.../common/utils/common.js 44% 66%
src/utils/file_utils.py 62% ~74%
web-src/.../schedule/SchedulePanel.vue ~1% ~73%
web-src/.../common/utils/parameterHistory.js 25% 98%
web-src/.../main-app/components/favicon_manager.js 0% 40%

Notes

  • migrate.py is driven through the public migrate() entry point, so the orchestration (registry, dependency ordering, migrations.txt state, new-installation detection) is covered alongside each of the 7 migrations. This code runs at every startup and rewrites users' config/log files, so it's the highest-value gap closed.
  • main.py is pure application wiring (instantiates services, starts Tornado); excluded via .coveragerc rather than tested, so the metric reflects testable code.
  • SchedulePanel.vue uses shallowMount to isolate the component logic from child input components' v-model side effects (a full mount made repeatPeriod-related assertions flaky).
  • parameterHistory.js uses an in-memory localStorage mock since jsdom doesn't expose one in this setup.
  • favicon_manager.js caps at 40%: the canvas-rendered icons (Image onload path) aren't executable under jsdom.

Verification

  • Backend: 1737 tests pass
  • Frontend: 968 tests pass

🤖 Generated with Claude Code

Thomas Kpenou and others added 6 commits June 18, 2026 11:33
Add 25 tests for src/migrations/migrate.py, previously untested despite
running at every startup and transforming users' config and log files.

All migrations are driven through the public migrate() entry point, so the
orchestration logic (registry, dependency ordering, migrations.txt state,
new-installation detection) is covered alongside each of the 7 migrations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
src/main.py is pure application wiring — it parses args, instantiates every
service and starts the Tornado server. It can't be unit-tested without a full
integration environment, so its uncovered lines only distorted the metric.
Excluding it makes the reported coverage reflect testable code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add 49 tests for the pure helpers and simple DOM utilities in
common/utils/common.js: emptiness checks, array/object helpers,
stringComparator, websocket-state checks, url/query helpers, id generators,
isFullRegexMatch, DOM traversal helpers and HttpRequestError.

Remaining gaps are browser-API-heavy functions (XHR, layout scrolling,
clipboard, canvas text measurement) that aren't meaningfully testable in jsdom.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add 43 tests for src/utils/file_utils.py: read/write round-trips (bytes,
newlines, encoding fallback), folder/existence helpers, path helpers
(normalize_path, relative_path, split_all, is_root), create_unique_filename,
make_executable, is_binary detection, broken-symlink detection,
modification/deletion dates, search_glob, and the FileMatcher /
SingleFileMatcher pattern logic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add 19 tests for SchedulePanel: scheduleType / weekdaysError computeds,
buildScheduleSetup (one-time, max_executions and end_datetime end options,
active weekday filtering, repeat unit/period), error tracking via
onFieldError/checkErrors, and the schedule/close actions (store action stubbed).

Uses shallowMount to isolate the component's logic from the child input
components' v-model side effects.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…er.js (0%→40%)

parameterHistory.js: 25 tests covering save/load (dedup, prepend, 10-entry cap,
corrupted storage, backward-compat favorite flag), getMostRecentValues,
remove/toggle (index guards, favorite protection, reordering) and the
shouldUseHistoricalValues flag, plus graceful handling of throwing storage.
An in-memory localStorage mock is used since jsdom doesn't expose one here.

favicon_manager.js: 5 tests for defaultFavicon, setFavicon append/replace and
the default fallback of the executing/finished setters. Canvas-rendered icons
(onload path) aren't testable under jsdom and are left uncovered.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@knep knep merged commit af85685 into master Jun 18, 2026
4 of 7 checks passed
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.

2 participants