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.
Problem
Five suites each carry a near-verbatim ~140-line copy of the same VideoGen mock scaffolding — the 20+
vi.mockcalls for../services/api,useModelDownloadStatus,useMediaJobSse, the heavyweight child components, plus astatehoisted object, amodel()fixture and arenderPage()helper:client/src/pages/VideoGen.terms.test.jsxclient/src/pages/VideoGen.federatedTarget.test.jsxclient/src/pages/VideoGen.composeWhileBusy.test.jsxclient/src/pages/VideoGen.textEncoderAutoDownload.test.jsxclient/src/pages/VideoGen.modelLoading.test.jsxCost: 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.jsfollowing the existing precedent inclient/src/test/openWorldPageMocks.js— its header documents the vitest-hoisting constraint and the shape that works: plain exported values (thestateobject, the fixtures,renderPage()), with thevi.mockregistrations staying in each test file, or a single exportedregisterVideoGenMocks()called at module scope before theawait 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.