test(miner-extension): cover options.js pure helpers without a jsdom harness - #7069
Conversation
…harness (JSONbored#7008) options.js's pure, DOM-independent helpers had no test file. Add test/options.test.ts using the same __LOOPOVER_MINER_EXTENSION_TEST__ import hook that content.test.ts (JSONbored#6189) already proved out: importing options.js on a non-mounted path (a null-returning document) exposes its internals without any jsdom mount harness. Covers parseWatchedRepos, parseRankedCandidatesJson (empty short-circuit, array parse, non-array rejection, and the UTF-8 byte-size quota that guards chrome.storage.local against silent over-quota failures), normalizeMinerUiUrl, and the legacy discoveryIndexUrl purge. Update the README's deferred-coverage note: content.js and options.js pure logic are now tested this way; only the mounted options-page/content-script UI event handlers still need a real DOM harness. Closes JSONbored#7008
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-17 20:53:28 UTC
Review summary Nits — 3 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-code)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Closes #7008
Summary
apps/loopover-miner-extension/options.js's pure, DOM-independent helpers had no test file, while its siblingcontent.jsalready proved out a lightweight, jsdom-free testing technique (test/content.test.ts, fix(extension): content.js's loadOpportunityBadge has no failure handling around chrome.runtime.sendMessage, unlike every other message call site #6189).test/options.test.tsusing the same__LOOPOVER_MINER_EXTENSION_TEST__import hook: importingoptions.json a non-mounted path (a null-returningdocument) makes it take its "options.html is not mounted" branch, exposing the internals with no DOM side effects and no jsdom mount harness.parseWatchedRepos,parseRankedCandidatesJson(empty short-circuit, array parse, non-array rejection, and the UTF-8 byte-size quota that guardschrome.storage.localagainst the silent over-quota failure of Add storage-size validation for pasted JSON #4863),normalizeMinerUiUrl(trim + default fallback), and the legacydiscoveryIndexUrlpurge (fix(miner-extension): remove dead discoveryIndexUrl config field #5343).content.jsandoptions.jspure logic are now tested this way; only the mounted options-page/content-script UI event handlers still genuinely need a real DOM harness.Scope
type(scope): short summaryConventional Commit format.apps/loopover-miner-extension/.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #7008.Validation
git diff --check— clean.npm run typecheck— 0 errors (the roottscconfig type-checks the newtest/options.test.ts).npm --workspace @loopover/miner-extension test— 31 tests pass (24 prior + 7 new) withvitest.config.tscoverage thresholds still met (options.jsis not incoverage.include, so the new test adds behavior coverage without moving the gated numbers, mirroringcontent.js).npm run miner-extension:lint(node --checkon all scripts) andnpm run miner-extension:typecheckpass; ESLint on the new test file is clean.If any required check was skipped, explain why:
test:coverage,test:workers,build:mcp/test:mcp-pack,ui:openapi:check,ui:lint/ui:typecheck/ui:build, andnpm auditare not applicable: this PR touches onlyapps/loopover-miner-extension/**(a test file plus a README note) — nosrc/**, no MCP/API/OpenAPI surface, no@loopover/uifiles, and no dependency changes.apps/**is outside the Codecovcodecov/patchscope, so there is no changed backend line/branch to cover; the extension's own vitest thresholds (verified above) are the relevant coverage signal.Safety
UI Evidencesection — N/A: this is a test-only + README-note change;options.js's runtime behavior and the extension UI are unchanged, so there is nothing visual to screenshot.UI Evidence
Not applicable — no visible UI, frontend, or behavioral change. This PR adds a unit-test file and updates a README note only;
options.jsitself is unchanged, so there is no rendered state to capture.Notes
vitestsuite is not currently a CI-gated step (CI runsminer-extension:lint/:typecheck/:build); the new test file is nonetheless type-checked by the roottypecheckjob and passes locally with thresholds met, matching howcontent.test.tsalready lives in this package.