From ec535b5f3c552cb40d60dc4a12c4e0b63681fd79 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Thu, 23 Jul 2026 22:37:38 -0700 Subject: [PATCH] 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 --- .../__tests__/SystemControlsArea.test.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/dashboard/app/components/command-center/__tests__/SystemControlsArea.test.tsx b/packages/dashboard/app/components/command-center/__tests__/SystemControlsArea.test.tsx index ff30a8fc23..a52caf8255 100644 --- a/packages/dashboard/app/components/command-center/__tests__/SystemControlsArea.test.tsx +++ b/packages/dashboard/app/components/command-center/__tests__/SystemControlsArea.test.tsx @@ -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();