test: share fakePdfjs fixture across viewer test files #542

Open
opened 2026-05-12 09:39:45 +02:00 by marcel · 0 comments
Owner

Context

makeFakePdfjsLib() is currently defined independently in two test files:

  • frontend/src/lib/document/viewer/PdfViewer.svelte.spec.ts
  • frontend/src/lib/document/viewer/usePdfRenderer.svelte.test.ts

The two copies are structurally similar but not identical. As more components adopt the libLoader injection pattern (per ADR 012), this fake will be defined a third and fourth time, causing drift between implementations.

Acceptance criteria

  • Extract a shared frontend/src/lib/document/viewer/__testUtils__/fakePdfjs.ts (or equivalent path) exporting makeFakePdfjsLib() and makeFakeLibLoader()
  • Both existing test files import from the shared module — no local copy remains
  • All tests in both files still pass after the extraction

Raised by Felix Brandt in PR #536 round-4 review.

## Context `makeFakePdfjsLib()` is currently defined independently in two test files: - `frontend/src/lib/document/viewer/PdfViewer.svelte.spec.ts` - `frontend/src/lib/document/viewer/usePdfRenderer.svelte.test.ts` The two copies are structurally similar but not identical. As more components adopt the `libLoader` injection pattern (per ADR 012), this fake will be defined a third and fourth time, causing drift between implementations. ## Acceptance criteria - Extract a shared `frontend/src/lib/document/viewer/__testUtils__/fakePdfjs.ts` (or equivalent path) exporting `makeFakePdfjsLib()` and `makeFakeLibLoader()` - Both existing test files import from the shared module — no local copy remains - All tests in both files still pass after the extraction Raised by Felix Brandt in PR #536 round-4 review.
marcel added the P3-laterrefactortest labels 2026-05-12 09:40:08 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#542