test(frontend): cover terminal toolbar session label

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Harshit Singh Bhandari 2026-07-03 20:19:10 +05:30
parent b46e14df19
commit 90c41764f1
No known key found for this signature in database
1 changed files with 38 additions and 0 deletions

View File

@ -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: () => <div>terminal body</div> }));
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(<CenterPane session={worker} theme="dark" daemonReady />);
expect(screen.getByText("do the thing")).toBeInTheDocument();
expect(screen.queryByText("sess-1")).not.toBeInTheDocument();
});
it("shows 'Orchestrator' for an orchestrator session", () => {
render(<CenterPane session={{ ...worker, id: "sess-orch", kind: "orchestrator" }} theme="dark" daemonReady />);
expect(screen.getByText("Orchestrator")).toBeInTheDocument();
});
it("shows 'No session' when there is no session", () => {
render(<CenterPane theme="dark" daemonReady />);
expect(screen.getByText("No session")).toBeInTheDocument();
});
});