Skip to content

Extract the shared VideoGen page test harness (5 near-identical mock scaffolds) #5836

Description

@atomantic

Problem

Five suites each carry a near-verbatim ~140-line copy of the same VideoGen mock scaffolding — the 20+ vi.mock calls for ../services/api, useModelDownloadStatus, useMediaJobSse, the heavyweight child components, plus a state hoisted object, a model() fixture and a renderPage() helper:

  • client/src/pages/VideoGen.terms.test.jsx
  • client/src/pages/VideoGen.federatedTarget.test.jsx
  • client/src/pages/VideoGen.composeWhileBusy.test.jsx
  • client/src/pages/VideoGen.textEncoderAutoDownload.test.jsx
  • client/src/pages/VideoGen.modelLoading.test.jsx

Cost: any new endpoint or hook the page starts calling has to be added in five places, or four suites break at once.

Work

Extract client/src/test/videoGenPageMocks.js following the existing precedent in client/src/test/openWorldPageMocks.js — its header documents the vitest-hoisting constraint and the shape that works: plain exported values (the state object, the fixtures, renderPage()), with the vi.mock registrations staying in each test file, or a single exported registerVideoGenMocks() called at module scope before the await import('./VideoGen.jsx') every one of these files already uses. Then reduce each of the five suites to its own fixtures and cases.

Behavior-preserving: no page or product code changes, and all five suites must keep passing unchanged assertions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort:lowEffort: lowmodel:lightModel size: lightplanTracked by /do:replanplanner:opus-5Plan authored by the opus-5 modeltestsTest suite / test infrastructure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions