Add workspace title display preference

This commit is contained in:
Mohamed Boudra
2026-06-20 19:44:30 +07:00
parent 0718e7c914
commit 68bbc75df1
12 changed files with 155 additions and 17 deletions
@@ -0,0 +1,31 @@
import { describe, expect, it } from "vitest";
import { resolveSidebarWorkspacePrimaryLabel } from "@/components/sidebar/sidebar-workspace-title";
describe("resolveSidebarWorkspacePrimaryLabel", () => {
it("uses the workspace name in title mode", () => {
const label = resolveSidebarWorkspacePrimaryLabel({
workspace: { name: "Investigate search", currentBranch: "fix/search" },
workspaceTitleSource: "title",
});
expect(label).toBe("Investigate search");
});
it("uses the branch name in branch mode", () => {
const label = resolveSidebarWorkspacePrimaryLabel({
workspace: { name: "Investigate search", currentBranch: "fix/search" },
workspaceTitleSource: "branch",
});
expect(label).toBe("fix/search");
});
it("falls back to the workspace name in branch mode without a branch", () => {
const label = resolveSidebarWorkspacePrimaryLabel({
workspace: { name: "Local folder", currentBranch: null },
workspaceTitleSource: "branch",
});
expect(label).toBe("Local folder");
});
});