FN-6076: align dashboard tests with updated labels and mocks

Update dashboard tests to match current project copy and test doubles.

- rename project selector expectations from 'Select Project'/'View All Projects' to 'Projects'/'Manage Projects'
- update mailbox split-handle CSS assertion for the new color-mix background
- simplify SessionTerminal xterm addon mocks and type the mocked AbortController signal in useDocuments tests

Files changed:
 .../app/components/__tests__/Header.test.tsx        |  8 ++++----
 .../app/components/__tests__/MailboxView.test.tsx   |  2 +-
 .../components/__tests__/MultiProjectFlow.test.tsx  |  2 +-
 .../__tests__/SessionTerminal.mobile.test.tsx       | 21 ++++-----------------
 .../app/hooks/__tests__/useDocuments.test.ts        |  4 ++--
 5 files changed, 12 insertions(+), 25 deletions(-)

Fusion-Task-Id: FN-6076

Fusion-Task-Lineage: 9bd7bd36-75c0-4d88-93b4-53bfb75283fa
This commit is contained in:
gsxdsm
2026-06-09 07:24:39 -07:00
parent 9417c81498
commit c285c30c19
5 changed files with 12 additions and 25 deletions

View File

@@ -1592,7 +1592,7 @@ describe("Header", () => {
expect(trigger).toHaveTextContent(longName);
});
it("falls back to 'Select Project' label when current project is missing", () => {
it("falls back to 'Projects' label when current project is missing", () => {
renderHeader({
projects,
currentProject: null,
@@ -1601,10 +1601,10 @@ describe("Header", () => {
}, "desktop");
const trigger = screen.getByTestId("project-selector-trigger");
expect(trigger).toHaveTextContent("Select Project");
expect(trigger).toHaveTextContent("Projects");
});
it("shows View All Projects action in dropdown and calls onViewAllProjects", () => {
it("shows Manage Projects action in dropdown and calls onViewAllProjects", () => {
const onViewAllProjects = vi.fn();
renderHeader({
projects,
@@ -1614,7 +1614,7 @@ describe("Header", () => {
}, "desktop");
fireEvent.click(screen.getByTestId("project-selector-trigger"));
fireEvent.click(screen.getByText("View All Projects"));
fireEvent.click(screen.getByText("Manage Projects"));
expect(onViewAllProjects).toHaveBeenCalled();
expect(screen.queryByTestId("project-selector-dropdown")).toBeNull();
});

View File

@@ -1829,7 +1829,7 @@ describe("MailboxView", () => {
expect(splitPaneBlock).toContain("border: var(--btn-border-width) solid var(--border);");
expect(splitPaneBlock).toContain("background: var(--surface);");
expect(css).toMatch(/\.mailbox-view\s+\.mailbox-split-resize-handle\s*\{[^}]*cursor:\s*col-resize;[^}]*background:\s*transparent;[^}]*\}/);
expect(css).toMatch(/\.mailbox-view\s+\.mailbox-split-resize-handle\s*\{[^}]*cursor:\s*col-resize;[^}]*background:\s*color-mix\(in srgb,\s*var\(--border\)\s*70%,\s*transparent\);[^}]*\}/);
const splitEmptyBlockMatch = css.match(/\.mailbox-view\s+\.mailbox-split-empty\s*\{([^}]*)\}/);
expect(splitEmptyBlockMatch).toBeTruthy();

View File

@@ -156,7 +156,7 @@ describe("MultiProjectFlow", () => {
);
fireEvent.click(screen.getByTestId("project-selector-trigger"));
const manageProjectsAction = screen.getByText("View All Projects");
const manageProjectsAction = screen.getByText("Manage Projects");
fireEvent.click(manageProjectsAction);
expect(handleViewAllProjects).toHaveBeenCalled();

View File

@@ -13,24 +13,11 @@ const mockTerm = {
cols: 80,
rows: 24,
};
vi.mock("@xterm/xterm", () => ({
Terminal: vi.fn(function (this: typeof mockTerm) {
Object.assign(this, mockTerm);
}),
}));
vi.mock("@xterm/addon-fit", () => ({
FitAddon: vi.fn(function (this: { fit: ReturnType<typeof vi.fn> }) {
this.fit = vi.fn();
}),
}));
vi.mock("@xterm/addon-unicode11", () => ({
Unicode11Addon: vi.fn(function () {}),
}));
vi.mock("@xterm/xterm", () => ({ Terminal: vi.fn(function Terminal() { return mockTerm; }) }));
vi.mock("@xterm/addon-fit", () => ({ FitAddon: vi.fn(function FitAddon() { return { fit: vi.fn() }; }) }));
vi.mock("@xterm/addon-unicode11", () => ({ Unicode11Addon: vi.fn(function Unicode11Addon() { return {}; }) }));
vi.mock("@xterm/addon-webgl", () => ({
WebglAddon: vi.fn(function (this: { onContextLoss: ReturnType<typeof vi.fn>; dispose: ReturnType<typeof vi.fn> }) {
this.onContextLoss = vi.fn();
this.dispose = vi.fn();
}),
WebglAddon: vi.fn(function WebglAddon() { return { onContextLoss: vi.fn(), dispose: vi.fn() }; }),
}));
const apiMock = vi.fn();

View File

@@ -228,8 +228,8 @@ describe("useDocuments", () => {
const abortMock = vi.fn();
const originalAbortController = globalThis.AbortController;
globalThis.AbortController = class {
signal = {};
globalThis.AbortController = class MockAbortController {
signal = {} as AbortSignal;
abort = abortMock;
} as unknown as typeof AbortController;