mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 06:42:06 +01:00
fix(cli): harden service lifecycle edge cases
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
c18d1d378f
commit
ed4eaf6f46
8 files changed
+72
-22
No files matched your search
@@ -79,8 +79,20 @@ describe("managed install commands", () => {
|
||||
const userData = path.join(process.env.PAPERCLIP_HOME!, "instances", "default", "keep.txt");
|
||||
fs.mkdirSync(path.dirname(userData), { recursive: true });
|
||||
fs.writeFileSync(userData, "keep");
|
||||
await uninstallCommand();
|
||||
const uninstallService = vi.fn(async () => {
|
||||
expect(fs.existsSync(paths.shimPath)).toBe(true);
|
||||
});
|
||||
await uninstallCommand({
|
||||
detectServiceManager: vi.fn(async () => ({
|
||||
supported: true as const,
|
||||
manager: {
|
||||
status: vi.fn(async () => ({ installed: true, active: true })),
|
||||
uninstall: uninstallService,
|
||||
} as never,
|
||||
})),
|
||||
});
|
||||
|
||||
expect(uninstallService).toHaveBeenCalledOnce();
|
||||
expect(fs.existsSync(paths.cliRoot)).toBe(false);
|
||||
expect(fs.existsSync(paths.shimPath)).toBe(false);
|
||||
expect(fs.readFileSync(userData, "utf8")).toBe("keep");
|
||||
|
||||
Reference in new issue
Block a user