Files
paseo/packages/app/src/components/worktree-setup-callout-policy.test.ts
T
nikuscsandMohamed Boudra 800bd2bef1 feat: add host-local custom project icons (#2335)
* feat(projects): add local icons and colors

* refactor(projects): simplify appearance handling

* fix(projects): serialize appearance saves

* test(app): update project appearance expectations

* test: fix project appearance CI expectations

* refactor(projects): organize appearance code

* fix(server): adopt main's reconcile model in project appearance updates

* fix(projects): preserve host-local appearance targets

* fix(desktop): restore Linux development startup

Ubuntu can block Electron's unprivileged user-namespace fallback while the npm-installed sandbox helper is not SUID. Disable the Chromium process sandbox only in the Linux development runner so packaged desktop policy remains unchanged.

* feat(projects): add custom project icons

Keep URL acquisition in the client so the host daemon only validates uploaded bytes. Project name and icon changes share one adaptive edit sheet.

* refactor(settings): scope projects by host

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-08-01 01:34:42 +08:00

59 lines
1.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
buildWorktreeSetupCalloutPolicy,
selectActiveGitWorkspaceProject,
shouldShowWorktreeSetupCallout,
} from "./worktree-setup-callout-policy";
describe("selectActiveGitWorkspaceProject", () => {
it("selects the host-local project id for a git workspace", () => {
expect(
selectActiveGitWorkspaceProject("server-1", {
projectId: "prj_local",
projectKind: "git",
projectRootPath: "/repo/project",
}),
).toEqual({
serverId: "server-1",
projectId: "prj_local",
repoRoot: "/repo/project",
});
});
it("ignores non-git workspaces and blank coordinates", () => {
expect(
selectActiveGitWorkspaceProject("server-1", {
projectId: "project",
projectKind: "directory",
projectRootPath: "/repo",
}),
).toBeNull();
});
});
describe("shouldShowWorktreeSetupCallout", () => {
it("shows only after a successful config read with no setup command", () => {
expect(shouldShowWorktreeSetupCallout({ ok: true, config: {} })).toBe(true);
expect(
shouldShowWorktreeSetupCallout({ ok: true, config: { worktree: { setup: "npm i" } } }),
).toBe(false);
expect(shouldShowWorktreeSetupCallout({ ok: false })).toBe(false);
});
});
describe("buildWorktreeSetupCalloutPolicy", () => {
it("routes by server id and project id", () => {
expect(
buildWorktreeSetupCalloutPolicy({
serverId: "server-1",
projectId: "prj_local",
repoRoot: "/repo/project",
}),
).toMatchObject({
id: "worktree-setup-missing:server-1:prj_local",
projectSettingsRoute: "/settings/hosts/server-1/projects/prj_local",
testID: "worktree-setup-callout-prj_local",
});
});
});