* Keep installed desktop skills up to date * Preserve user files during skill sync
74 lines
2.2 KiB
TypeScript
74 lines
2.2 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { runDesktopStartup } from "./desktop-startup";
|
|
|
|
describe("desktop startup", () => {
|
|
it("runs CLI passthrough before GUI login-shell env inheritance", async () => {
|
|
const calls: string[] = [];
|
|
await runDesktopStartup({
|
|
hasPendingOpenProjectPath: false,
|
|
runCliPassthroughIfRequested: vi.fn(async () => {
|
|
calls.push("cli");
|
|
return true;
|
|
}),
|
|
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
|
|
bootstrapGui: vi.fn(async () => {
|
|
calls.push("gui");
|
|
}),
|
|
});
|
|
|
|
expect(calls).toEqual(["cli"]);
|
|
});
|
|
|
|
it("keeps login-shell env inheritance on normal GUI startup", async () => {
|
|
const calls: string[] = [];
|
|
await runDesktopStartup({
|
|
hasPendingOpenProjectPath: false,
|
|
runCliPassthroughIfRequested: vi.fn(async () => {
|
|
calls.push("cli");
|
|
return false;
|
|
}),
|
|
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
|
|
bootstrapGui: vi.fn(async () => {
|
|
calls.push("gui");
|
|
}),
|
|
});
|
|
|
|
expect(calls).toEqual(["cli", "env", "gui"]);
|
|
});
|
|
|
|
it("starts skills auto-update after GUI startup", async () => {
|
|
const calls: string[] = [];
|
|
await runDesktopStartup({
|
|
hasPendingOpenProjectPath: false,
|
|
runCliPassthroughIfRequested: vi.fn(async () => {
|
|
calls.push("cli");
|
|
return false;
|
|
}),
|
|
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
|
|
bootstrapGui: vi.fn(async () => {
|
|
calls.push("gui");
|
|
}),
|
|
autoUpdateInstalledSkills: vi.fn(() => calls.push("skills")),
|
|
});
|
|
|
|
expect(calls).toEqual(["cli", "env", "gui", "skills"]);
|
|
});
|
|
|
|
it("does not route open-project launches through CLI passthrough", async () => {
|
|
const runCliPassthroughIfRequested = vi.fn(async () => true);
|
|
const calls: string[] = [];
|
|
|
|
await runDesktopStartup({
|
|
hasPendingOpenProjectPath: true,
|
|
runCliPassthroughIfRequested,
|
|
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
|
|
bootstrapGui: vi.fn(async () => {
|
|
calls.push("gui");
|
|
}),
|
|
});
|
|
|
|
expect(runCliPassthroughIfRequested).not.toHaveBeenCalled();
|
|
expect(calls).toEqual(["env", "gui"]);
|
|
});
|
|
});
|