test: close coverage gaps in persistence, portal stores, EPG, players, and E2E#1124
Conversation
…igrations Add specs for the previously untested persistence paths: playback-position and recently-viewed operations (upsert/dedup/ordering/scoped deletes), shared-database path-utils, createTables and the tolerant column/index migrations incl. Xtream cache deduplication. Exposes createTables through the existing __databaseConnectionTestHooks object. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…uards Add specs for electron-xtream-data-source (DB-hit vs cold-cache paths, concurrent request dedup, error propagation, full method delegation) and extend the favorites feature spec with the invalid-input and content-not-found guard paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add specs for with-stalker-favorites and with-stalker-recent: payload normalization and id/title fallbacks, series-mode category forcing, meta sync dispatches, snackbar/callback side effects, and error paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add specs for the pure catch-up window and summary-progress helpers shared by the EPG panels, and for epg-worker.service: in-flight dedup by URL, double-settle guard, progress-aware timeouts, worker lifecycle and error broadcasting. Also settle an interrupted fetch in epg.events.spec that caused "Cannot log after tests are done" in longer runs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mirror the MPV session spec patterns for VLC: enqueue-command building and RC response parsing, launch argv construction, instance reuse over the RC socket, exit-code handling, and the retry-without-RC fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Downloads: empty state without sources, and a full lifecycle - authorize a folder via a stubbed native dialog, download from a local server, verify the completed item and file on disk, remove it from the UI. Timeline: zoom changes block widths and the on-air info affordance opens the programme dialog with the correct title and watch-live action. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Greptile SummaryThis PR closes test-coverage gaps across the persistence layer, portal stores, EPG utilities, player services, and E2E flows, adding ~146 new unit tests and 3 new E2E tests across 18 new spec files. The single production-code change exposes
Confidence Score: 5/5Safe to merge — effectively a test-only change with one minimal, well-scoped production line added. The single production-code edit (exposing createTables through the already-existing __databaseConnectionTestHooks object) is backward-compatible and introduces no runtime risk. Every other file is a new or extended test. The test infrastructure is sound: module mocks are file-scoped, timers are restored in afterEach, and E2E tests clean up with try/finally. No functional regressions are introduced. libs/portal/xtream/data-access/src/lib/data-sources/electron-xtream-data-source.spec.ts sits at exactly 350 lines — the start of the hard-maximum range described in CLAUDE.md — and could be split as a follow-up. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph "New Unit Test Coverage"
DB["DB Layer\nplayback-position.operations.spec\nrecently-viewed.operations.spec\nconnection-migrations.spec\npath-utils.spec"]
XD["Xtream Data Source\nelectron-xtream-data-source.spec\n.delegation.spec\n.user-data.spec"]
SF["Store Features\nwith-favorites.feature.spec (extended)\nwith-stalker-favorites.feature.spec\nwith-stalker-recent.feature.spec"]
EPG["EPG Utilities\nepg-archive.util.spec\nepg-summary.util.spec\nepg-worker.service.spec\nepg-worker.service.progress.spec\nepg.events.spec (fixed)"]
PL["Players\nvlc-session.service.spec\nvlc-session.service.lifecycle.spec"]
end
subgraph "New E2E Coverage"
DL["downloads.e2e.ts\nEmpty state\nFull lifecycle (local server + native dialog stub)"]
TL["epg-timeline-interaction.e2e.ts\nZoom re-render\nProgramme dialog open"]
end
subgraph "Infrastructure"
TH["operations.test-helpers.ts\nShared Drizzle-ORM mocks"]
TC["tsconfig.app.json\nExcludes .test-helpers.ts from prod build"]
CT["connection.ts (+1 line)\nExposes createTables via __databaseConnectionTestHooks"]
end
TH --> DB
TH --> XD
CT --> DB
TC --> TH
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph "New Unit Test Coverage"
DB["DB Layer\nplayback-position.operations.spec\nrecently-viewed.operations.spec\nconnection-migrations.spec\npath-utils.spec"]
XD["Xtream Data Source\nelectron-xtream-data-source.spec\n.delegation.spec\n.user-data.spec"]
SF["Store Features\nwith-favorites.feature.spec (extended)\nwith-stalker-favorites.feature.spec\nwith-stalker-recent.feature.spec"]
EPG["EPG Utilities\nepg-archive.util.spec\nepg-summary.util.spec\nepg-worker.service.spec\nepg-worker.service.progress.spec\nepg.events.spec (fixed)"]
PL["Players\nvlc-session.service.spec\nvlc-session.service.lifecycle.spec"]
end
subgraph "New E2E Coverage"
DL["downloads.e2e.ts\nEmpty state\nFull lifecycle (local server + native dialog stub)"]
TL["epg-timeline-interaction.e2e.ts\nZoom re-render\nProgramme dialog open"]
end
subgraph "Infrastructure"
TH["operations.test-helpers.ts\nShared Drizzle-ORM mocks"]
TC["tsconfig.app.json\nExcludes .test-helpers.ts from prod build"]
CT["connection.ts (+1 line)\nExposes createTables via __databaseConnectionTestHooks"]
end
TH --> DB
TH --> XD
CT --> DB
TC --> TH
Reviews (3): Last reviewed commit: "fix(build): exclude *.test-helpers.ts fr..." | Re-trigger Greptile |
Address review feedback: extract shared drizzle mocks into operations.test-helpers.ts and split the Electron data-source delegation spec into delegation + user-data files. Pure reorganization - test counts and assertions unchanged (29/13/10), all files now under 300 lines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
On slow CI runners (macOS) the renderer can query SQLite while the DB worker is still creating tables, leaving the downloads page on its skeleton state forever. Poll a playlist read until it succeeds before navigating on a cold profile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…sconfig The new operations.test-helpers.ts uses jest globals and broke the webpack build and tsc typecheck, which compile every non-spec file in the app. Exclude the test-helpers pattern alongside the existing spec exclusions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
createTablesthrough the existing__databaseConnectionTestHooksobject.Changes
playback-position.operations(upsert, placeholder-playlist auto-creation, scoped reads/deletes),recently-viewed.operations(dedup, newest-first, 100-row cap, batch removal),path-utils, andcreateTables/column+index migrations incl. Xtream cache deduplication.electron-xtream-data-sourceDB-hit vs cold-cache paths, concurrent-request dedup, error propagation, and full method delegation; new guard-path tests inwith-favorites.feature.with-stalker-favoritesandwith-stalker-recentfeature specs (payload normalization, series-mode category forcing, meta sync, error paths).epg-archive.utilandepg-summary.util— the pure helpers shared by the timeline (and the upcoming list view from feat(epg): add vertical list view for the live EPG panel #1115);epg-worker.servicein-flight dedup, double-settle guard, progress-aware timeouts, worker lifecycle. Also settles an interrupted fetch inepg.events.specthat produced "Cannot log after tests are done" in longer runs.vlc-session.servicespecs mirroring the MPV patterns — launch argv, RC-socket reuse, exit-code handling, retry-without-RC fallback.downloads.e2e.ts(empty state; full lifecycle with a stubbed native folder dialog, real download from a local server, file-on-disk assertion, UI removal) andepg-timeline-interaction.e2e.ts(zoom re-render, on-air info affordance opens the programme dialog).Testing
pnpm nx run-many --target=test --projects=electron-backend,portal-xtream-data-access,portal-stalker-data-access,ui-epg,database— all green (~842 tests, of which ~146 are new)pnpm nx run electron-backend-e2e:e2e-ci--src/downloads.e2e.ts— 2/2 passedpnpm nx run electron-backend-e2e:e2e-ci--src/epg-timeline-interaction.e2e.ts— 1/1 passedpnpm nx run-many --target=lintacross all six touched projects — cleanNote: one flaky
addXtreamPortalnavigation timeout was observed once in a shared E2E fixture (unrelated to the new specs; it can also affect existing suites).🤖 Generated with Claude Code