# Conflicts: # packages/app/e2e/helpers/workspace-setup.ts # packages/app/src/components/sidebar-workspace-list.tsx # packages/app/src/contexts/session-context.tsx # packages/app/src/hooks/use-sidebar-workspaces-list.test.ts # packages/app/src/screens/workspace/workspace-tab-menu.ts # packages/app/src/stores/workspace-setup-store.ts # packages/app/src/stores/workspace-tabs-store.ts # packages/app/src/utils/sidebar-project-row-model.test.ts # packages/app/src/utils/sidebar-shortcuts.test.ts # packages/app/src/utils/workspace-tab-identity.ts # packages/server/src/server/bootstrap.ts # packages/server/src/server/worktree-session.ts
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
resolveWorkspaceHeader,
|
|
shouldRenderMissingWorkspaceDescriptor,
|
|
} from "./workspace-header-source";
|
|
import { buildSidebarProjectsFromWorkspaces } from "@/hooks/use-sidebar-workspaces-list";
|
|
import type { WorkspaceDescriptor } from "@/stores/session-store";
|
|
|
|
describe("workspace source of truth consumption", () => {
|
|
it("uses the same descriptor name in header and sidebar row", () => {
|
|
const workspace: WorkspaceDescriptor = {
|
|
id: "/repo/main",
|
|
projectId: "remote:github.com/getpaseo/paseo",
|
|
projectDisplayName: "getpaseo/paseo",
|
|
projectRootPath: "/repo/main",
|
|
workspaceDirectory: "/repo/main",
|
|
projectKind: "git",
|
|
workspaceKind: "checkout",
|
|
name: "feat/workspace-sot",
|
|
status: "running",
|
|
activityAt: new Date("2026-03-01T00:00:00.000Z"),
|
|
diffStat: null,
|
|
services: [],
|
|
};
|
|
|
|
const header = resolveWorkspaceHeader({ workspace });
|
|
const sidebarProjects = buildSidebarProjectsFromWorkspaces({
|
|
serverId: "srv",
|
|
workspaces: [workspace],
|
|
projectOrder: [],
|
|
workspaceOrderByScope: {},
|
|
});
|
|
|
|
expect(header.title).toBe("feat/workspace-sot");
|
|
expect(header.subtitle).toBe("getpaseo/paseo");
|
|
expect(sidebarProjects[0]?.workspaces[0]?.name).toBe(header.title);
|
|
expect(sidebarProjects[0]?.workspaces[0]?.statusBucket).toBe("running");
|
|
});
|
|
|
|
it("renders explicit missing state only after workspace hydration", () => {
|
|
expect(
|
|
shouldRenderMissingWorkspaceDescriptor({
|
|
workspace: null,
|
|
hasHydratedWorkspaces: true,
|
|
}),
|
|
).toBe(true);
|
|
|
|
expect(
|
|
shouldRenderMissingWorkspaceDescriptor({
|
|
workspace: null,
|
|
hasHydratedWorkspaces: false,
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
});
|