diff --git a/frontend/src/renderer/components/CenterPane.test.tsx b/frontend/src/renderer/components/CenterPane.test.tsx new file mode 100644 index 000000000..f4ebef8a1 --- /dev/null +++ b/frontend/src/renderer/components/CenterPane.test.tsx @@ -0,0 +1,38 @@ +import { render, screen } from "@testing-library/react"; +import { describe, expect, it, vi } from "vitest"; +import type { WorkspaceSession } from "../types/workspace"; +import { CenterPane } from "./CenterPane"; + +// The terminal body pulls in xterm/SSE machinery irrelevant to the toolbar under test. +vi.mock("./TerminalPane", () => ({ TerminalPane: () =>
terminal body
})); + +const worker = { + id: "sess-1", + workspaceId: "proj-1", + workspaceName: "my-app", + title: "do the thing", + provider: "claude-code", + kind: "worker", + branch: "ao/sess-1", + status: "working", + updatedAt: "2026-06-10T00:00:00Z", + prs: [], +} satisfies WorkspaceSession; + +describe("CenterPane toolbar session label", () => { + it("shows the session display name for a worker", () => { + render(); + expect(screen.getByText("do the thing")).toBeInTheDocument(); + expect(screen.queryByText("sess-1")).not.toBeInTheDocument(); + }); + + it("shows 'Orchestrator' for an orchestrator session", () => { + render(); + expect(screen.getByText("Orchestrator")).toBeInTheDocument(); + }); + + it("shows 'No session' when there is no session", () => { + render(); + expect(screen.getByText("No session")).toBeInTheDocument(); + }); +}); diff --git a/frontend/src/renderer/components/CenterPane.tsx b/frontend/src/renderer/components/CenterPane.tsx index 09d494ae5..e0a2fca45 100644 --- a/frontend/src/renderer/components/CenterPane.tsx +++ b/frontend/src/renderer/components/CenterPane.tsx @@ -2,7 +2,7 @@ import { ChevronLeft, Maximize2, Minimize2, Shield } from "lucide-react"; import { useCallback, useEffect, useRef, useState, type WheelEvent } from "react"; import type { Theme } from "../stores/ui-store"; import type { TerminalTarget } from "../types/terminal"; -import type { WorkspaceSession } from "../types/workspace"; +import { isOrchestratorSession, type WorkspaceSession } from "../types/workspace"; import { TerminalPane } from "./TerminalPane"; type CenterPaneProps = { @@ -99,7 +99,9 @@ export function CenterPane({ session, theme, daemonReady, terminalTarget, onSele
TERMINAL - {session?.id ?? "No session"} + + {!session ? "No session" : isOrchestratorSession(session) ? "Orchestrator" : session.title} +