fix(dashboard-tests): stub Element.prototype.scrollIntoView in SystemControlsArea suite
The rebuild-job effect schedules jobSectionRef scrollIntoView in a rAF; jsdom elements lack the method, so a frame firing before unmount threw an unhandled error that failed the run even with all assertions passing. Module-level stub follows the ChatView.message-edit convention; the per-test spy still overrides it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,18 @@ import { act, fireEvent, render, screen, waitFor, within } from "@testing-librar
|
||||
import "@testing-library/jest-dom";
|
||||
import { CommandCenter } from "../CommandCenter";
|
||||
|
||||
/*
|
||||
FNXC:CommandCenterSystemTests 2026-07-23-22:35:
|
||||
jsdom elements do not implement scrollIntoView, but SystemControlsArea's
|
||||
job-section effect calls jobSectionRef.current?.scrollIntoView(...) inside a
|
||||
requestAnimationFrame while a rebuild job is running. If that frame fires
|
||||
before unmount cleanup, the missing method throws as an unhandled error and
|
||||
fails the whole run even though every assertion passed. Stub it module-wide
|
||||
(same convention as ChatView tests); the per-test spy below still swaps in
|
||||
its own vi.fn() and restores this stub afterwards.
|
||||
*/
|
||||
Element.prototype.scrollIntoView = vi.fn();
|
||||
|
||||
const apiMock = vi.fn();
|
||||
const mockFetchSystemInfo = vi.fn();
|
||||
const mockFetchCurrentSystemRebuild = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user