From 90c0e9936e5fb86e622d1cf568b229e4643ea58c Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Thu, 25 Jun 2026 17:32:34 -0700 Subject: [PATCH] FN-7009: update dashboard tests for current labels Refresh dashboard test expectations so they follow current project setup and theme metadata. - Assert setup wizard registration payloads include workspace and task-prefix fields. - Resolve default theme assertions through shared theme metadata instead of hardcoded labels. - Update Command Center theme dropdown coverage to use the current default theme label. Files changed: .../app/components/__tests__/SetupWizardModal.test.tsx | 16 +++++++++------- .../app/components/__tests__/ThemeSelector.test.tsx | 11 ++++++----- .../__tests__/CommandCenterControls.test.tsx | 12 +++++++----- 3 files changed, 22 insertions(+), 17 deletions(-) Fusion-Task-Id: FN-7009 Fusion-Task-Lineage: 1255f1b5-b63d-4366-afe6-5d72ca15cb1a --- .../__tests__/SetupWizardModal.test.tsx | 16 +++++++++------- .../components/__tests__/ThemeSelector.test.tsx | 11 ++++++----- .../__tests__/CommandCenterControls.test.tsx | 12 +++++++----- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/packages/dashboard/app/components/__tests__/SetupWizardModal.test.tsx b/packages/dashboard/app/components/__tests__/SetupWizardModal.test.tsx index cd70277d64..5643b1bbc9 100644 --- a/packages/dashboard/app/components/__tests__/SetupWizardModal.test.tsx +++ b/packages/dashboard/app/components/__tests__/SetupWizardModal.test.tsx @@ -240,10 +240,11 @@ describe("SetupWizardModal", () => { fireEvent.click(screen.getByText("Register Project")); await waitFor(() => { - // FNXC:Onboarding 2026-06-25-13:20: - // Existing-directory payload now carries `workspaceMode` (FNXC:Workspace) and - // auto-derived `taskPrefix` (FNXC:TaskPrefix). A non-workspace dir stays - // workspaceMode:false; prefix derives from name "project" -> "PROJ". + /* + FNXC:SetupWizard 2026-06-25-16:55: + Project registration now always sends the operator-visible workspace and task prefix fields, even when the existing-directory path is a single repo. + Keep this stale-expectation test pinned to the current create-project contract instead of asserting the pre-workspace payload shape. + */ expect(mockRegisterProject).toHaveBeenCalledWith({ name: "project", path: "/existing/project", @@ -303,9 +304,10 @@ describe("SetupWizardModal", () => { fireEvent.click(screen.getByText("Register Project")); await waitFor(() => { - // FNXC:Onboarding 2026-06-25-13:20: - // Clone payload also carries workspaceMode:false (clone always creates a single - // fresh repo) and taskPrefix derived from name "fusion" -> "FUSI". + /* + FNXC:SetupWizard 2026-06-25-16:55: + Clone registration uses the same explicit workspace/task-prefix contract as existing-directory registration so downstream project setup receives one complete shape. + */ expect(mockRegisterProject).toHaveBeenCalledWith({ name: "fusion", path: "/tmp/fusion", diff --git a/packages/dashboard/app/components/__tests__/ThemeSelector.test.tsx b/packages/dashboard/app/components/__tests__/ThemeSelector.test.tsx index 77498a9080..18aebd0d03 100644 --- a/packages/dashboard/app/components/__tests__/ThemeSelector.test.tsx +++ b/packages/dashboard/app/components/__tests__/ThemeSelector.test.tsx @@ -89,11 +89,12 @@ describe("ThemeSelector", () => { expect(screen.getByLabelText(`${theme.label} theme`)).toBeDefined(); } expect(THEME_OPTIONS.map((theme) => theme.value)).toEqual([...COLOR_THEMES]); - // FNXC:Theme 2026-06-25-13:15: The "default" color-theme value is labeled "Fusion Legacy" - // (brand rename); its accessible option label is therefore "Fusion Legacy theme". Resolve - // the active option by the value's current label so this stays robust to relabels. - const defaultLabel = THEME_OPTIONS.find((theme) => theme.value === "default")?.label ?? "Fusion Legacy"; - expect(screen.getByLabelText(`${defaultLabel} theme`).getAttribute("aria-pressed")).toBe("true"); + /* + FNXC:Theme 2026-06-25-16:55: + The default color theme can be renamed for users without changing its persisted value; assert the selected default option through shared theme metadata so tests do not go stale on label-only copy changes. + */ + const defaultTheme = THEME_OPTIONS.find((theme) => theme.value === "default")!; + expect(screen.getByLabelText(`${defaultTheme.label} theme`).getAttribute("aria-pressed")).toBe("true"); }); it("renders every shared swatch class from themeOptions", () => { diff --git a/packages/dashboard/app/components/command-center/__tests__/CommandCenterControls.test.tsx b/packages/dashboard/app/components/command-center/__tests__/CommandCenterControls.test.tsx index 2b4f715764..6536f1c7bb 100644 --- a/packages/dashboard/app/components/command-center/__tests__/CommandCenterControls.test.tsx +++ b/packages/dashboard/app/components/command-center/__tests__/CommandCenterControls.test.tsx @@ -3,6 +3,7 @@ import { join } from "node:path"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { act, fireEvent, render, screen, within } from "@testing-library/react"; import { CommandCenterControls } from "../CommandCenterControls"; +import { COLOR_THEMES } from "../../themeOptions"; const commandCenterControlsCss = readFileSync( join(process.cwd(), "app/components/command-center/CommandCenterControls.css"), @@ -273,11 +274,12 @@ describe("CommandCenterControls", () => { ); await flushPromises(); - // FNXC:Theme 2026-06-25-13:40: - // The historical "default" colorTheme id is now surfaced as "Fusion Legacy" - // (Ocean is the new default label, see themeOptions). The trigger button name - // therefore reads "Fusion Legacy" for colorTheme="default". - fireEvent.click(screen.getByRole("button", { name: /fusion legacy/i })); + /* + FNXC:Theme 2026-06-25-16:55: + Command Center embeds the shared theme dropdown, whose trigger label follows the current theme copy; look up the default label from theme metadata instead of assuming user-facing text contains "Default". + */ + const defaultTheme = COLOR_THEMES.find((theme) => theme.value === "default")!; + fireEvent.click(screen.getByRole("button", { name: defaultTheme.label })); fireEvent.click(screen.getAllByRole("option").find((element) => element.textContent?.trim() === "Forest")!); expect(onColorThemeChange).toHaveBeenCalledWith("forest");