test(frontend): harness expansion + utility coverage push (F0 + F6) (#539)

* test(frontend): expand harness for store/component/contract tests

- factories: makeSubsonicSong, makeServer, makeAuthState, makeQueueState
- storeReset.ts: per-test reset for player/auth/preview/orbit stores
- mocks/subsonic.ts: realistic fixtures + stream/cover URL helpers
- mocks/browser.ts: ResizeObserver/IntersectionObserver/matchMedia/clipboard/object URLs
- mocks/tauri.ts: tauriMockListenerCount for listener-lifecycle regression tests
- renderWithProviders: pin i18n language to 'en' by default; { language } opt-out
- vitest.config: pool 'forks' + isolate to avoid module-mock + Zustand-global flake
- README: documented patterns, store-reset policy, i18n rule, isolation rationale

* test(frontend): bump utility coverage + expand hot-path gate

serverMagicString: 71→100% (encode/decode rejection branches, clipboard
fallback paths). shareLink: 69→97% (all entity kinds, queue trim, orbit
decoder, findServerIdForShareUrl). dynamicColors: 44→100% (extractCoverColors
DOM paths via Image / canvas / fetch mocks).

Gate adds shareLink.ts and dynamicColors.ts — both stable above 95%.
Comments updated for the new floor and the M4 hard-gate handoff.
This commit is contained in:
Frank Stellmacher
2026-05-11 21:11:23 +02:00
committed by GitHub
parent a228ce1c91
commit 4f9ad07d65
13 changed files with 990 additions and 35 deletions
+10 -6
View File
@@ -7,22 +7,26 @@
#
# Soft today (warnings only — the workflow carries `continue-on-error: true`).
# Flip to a hard PR-blocker by removing `continue-on-error` from the
# `frontend-tests` workflow once a few PRs have run cleanly.
# `frontend-tests` workflow at the start of M4 in the pre-refactor testing
# plan (2026-05-11), once Phase 13 characterization tests have proven the
# gate stable on a handful of real PRs.
#
# Curation rule (mirrors the backend list): a file belongs here when its
# hot-path code dominates the file and ≥70 % is a reasonable floor. Files
# that are partially covered today but contain large untested surface area
# (e.g. `playerStore.ts`, the unfinished half of `previewStore.ts`) live
# OUTSIDE the gate until their tests grow. Add them as Phase 1 coverage
# OUTSIDE the gate until their tests grow. Add them as Phase 14 coverage
# work lands.
#
# Deferred from the gate, with current coverage shown for reference:
# - src/store/previewStore.ts (33 % — only `_on*` + `stopPreview` covered)
# - src/store/playerStore.ts (0 % — 3300-LOC monolith, Phase 2 target)
# - src/utils/dynamicColors.ts (44 % — existing tests miss branches)
# - src/utils/shareLink.ts (69 % — borderline, ~5 lines short)
# - src/store/previewStore.ts (33 % — only `_on*` + `stopPreview` covered, Phase 4 target)
# - src/store/playerStore.ts (0 % — 3700-LOC monolith, Phase 1 target)
# - src/store/authStore.ts (18 % — Phase 2 target)
# - src/api/subsonic.ts (Phase 3 target)
# ── utils (already at or above threshold) ────────────────────────────
src/utils/coverArtRegisteredSizes.ts
src/utils/serverDisplayName.ts
src/utils/serverMagicString.ts
src/utils/shareLink.ts
src/utils/dynamicColors.ts