test(frontend): document the app.js VM stub contract and drop redundant label-test cleanup #260

Open
opened 2026-10-03 10:45:40 +00:00 by gabogg · 0 comments
Owner

P3 follow-up from PR #243 review pass 2 (standards axis).

Finding

  • tests/frontend/test_business_cycle_i18n.test.js:10-24 evaluates all of app.js in a VM, stubbing only t, localStorage, window and document.addEventListener/getElementById. If someone later adds top-level code that uses fetch, navigator, setInterval or querySelector, this i18n test breaks for an unrelated reason. The test also overwrites two globals after the VM eval.
  • tests/test_business_cycle_labels.py::test_timespan_labels_are_english saves the config and restores it in try/finally, even though isolated_repository_db already gives each test a fresh DB.

Acceptance Criteria

  • A short comment, or a shared helper, states the stub contract for evaluating app.js in a VM.
  • The redundant save/restore is removed.
P3 follow-up from PR #243 review pass 2 (standards axis). ### Finding - `tests/frontend/test_business_cycle_i18n.test.js:10-24` evaluates all of app.js in a VM, stubbing only `t`, `localStorage`, `window` and `document.addEventListener/getElementById`. If someone later adds top-level code that uses `fetch`, `navigator`, `setInterval` or `querySelector`, this i18n test breaks for an unrelated reason. The test also overwrites two globals after the VM eval. - `tests/test_business_cycle_labels.py::test_timespan_labels_are_english` saves the config and restores it in try/finally, even though `isolated_repository_db` already gives each test a fresh DB. ### Acceptance Criteria - A short comment, or a shared helper, states the stub contract for evaluating app.js in a VM. - The redundant save/restore is removed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#260
No description provided.