feat: add console workspace shell

This commit is contained in:
lda
2026-08-04 20:25:31 +07:00 Verified
parent 38b1cb8d03
commit ad3090e5be
11 changed files with 789 additions and 190 deletions
@@ -0,0 +1,60 @@
import { render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import { cleanup } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import { initialState } from "../app/state.js";
import { ConsoleShell } from "./ConsoleShell.js";
afterEach(() => cleanup());
describe("ConsoleShell", () => {
it("renders the connection header, lifecycle rail, main content, and evidence surface", () => {
render(
<MemoryRouter initialEntries={["/console/discover"]}>
<ConsoleShell
connection={initialState()}
onConnect={() => undefined}
onDraftChange={() => undefined}
>
<p>Discover content</p>
</ConsoleShell>
</MemoryRouter>,
);
expect(screen.getByRole("banner")).toBeInTheDocument();
expect(screen.getByRole("navigation", { name: "Workflow lifecycle" })).toBeInTheDocument();
expect(screen.getByRole("main", { name: "Console workspace" })).toHaveTextContent(
"Discover content",
);
expect(screen.getByRole("complementary", { name: "Operation evidence" })).toBeInTheDocument();
expect(screen.getByRole("link", { name: "Discover" })).toHaveAttribute(
"aria-current",
"page",
);
});
it("renders all lifecycle links with route destinations", () => {
render(
<MemoryRouter>
<ConsoleShell
connection={initialState()}
onConnect={() => undefined}
onDraftChange={() => undefined}
>
<p>Content</p>
</ConsoleShell>
</MemoryRouter>,
);
for (const { label, href } of [
{ label: "Discover", href: "/console/discover" },
{ label: "Drafts", href: "/console/drafts" },
{ label: "Artifacts", href: "/console/artifacts" },
{ label: "Deployments", href: "/console/deployments" },
{ label: "Runs", href: "/console/runs" },
{ label: "Results", href: "/console/results" },
]) {
expect(screen.getByRole("link", { name: label })).toHaveAttribute("href", href);
}
});
});