From dc83adcbd47506d0201aefcba5fc545fca5e1973 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 15 Nov 2026 21:27:28 +0800 Subject: [PATCH] test(setup): scope simulated-Windows Claude Desktop uninstall to the client under test (#11137) --- .../claudeDesktopClientConfiguration.test.ts | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/boundary/filesystem/claudeDesktopClientConfiguration.test.ts b/tests/boundary/filesystem/claudeDesktopClientConfiguration.test.ts index c896c39337..b2d9f0e346 100644 --- a/tests/boundary/filesystem/claudeDesktopClientConfiguration.test.ts +++ b/tests/boundary/filesystem/claudeDesktopClientConfiguration.test.ts @@ -29,6 +29,7 @@ import { import { runUninstall, systemUninstallHost, + type UninstallHost, } from "../../../src/application/Uninstall.js"; import { resolveMcpRegistrationClients } from "../../../src/application/McpRegistrationCatalog.js"; import { ArtifactResourceScope } from "../../../src/artifacts/ArtifactResourceScope.js"; @@ -76,6 +77,23 @@ const claudeDesktop = ( return client; }; +/** + * Uninstall scoped to Claude Desktop. A simulated Windows profile on a POSIX + * temp home has no drive letter, so clients that refuse driveless paths (Kilo) + * would fail for reasons unrelated to these tests. + */ +const claudeDesktopUninstallHost = ( + home: string, + env: Readonly>, +): UninstallHost => { + const host = systemUninstallHost(home, undefined, env, "win32"); + return { + ...host, + clients: async () => + (await host.clients()).filter(({ name }) => name === "claude_desktop"), + }; +}; + const writeJson = async (path: string, value: unknown): Promise => { await mkdir(dirname(path), { recursive: true }); await writeFile(path, `${JSON.stringify(value, null, 2)}\n`); @@ -237,7 +255,7 @@ describe("Windows Claude Desktop configuration location", () => { ).resolves.toEqual({ status: "failed", reason: "path" }); const uninstall = await runUninstall( false, - systemUninstallHost(home, undefined, env, "win32"), + claudeDesktopUninstallHost(home, env), ); expect(uninstall.status).toBe("failed"); expect(uninstall.items).toContainEqual( @@ -348,7 +366,7 @@ it("preserves explicit AppData root whitespace throughout setup, doctor and unin }); const uninstall = await runUninstall( false, - systemUninstallHost(home, undefined, selected, "win32"), + claudeDesktopUninstallHost(home, selected), ); expect(uninstall.status).toBe("complete"); expect(await readJson(appDataConfig)).toEqual(original); @@ -533,7 +551,7 @@ describe("MSIX Claude Desktop uninstall", () => { const result = await runUninstall( false, - systemUninstallHost(home, undefined, env, "win32"), + claudeDesktopUninstallHost(home, env), ); expect(result.status).toBe("failed"); @@ -558,7 +576,7 @@ describe("MSIX Claude Desktop uninstall", () => { await writeJson(appDataConfig, unrelated); const result = await runUninstall( false, - systemUninstallHost(home, undefined, env, "win32"), + claudeDesktopUninstallHost(home, env), ); expect(result.status).toBe("complete"); expect(await readJson(appDataConfig)).toEqual(unrelated); @@ -574,7 +592,7 @@ describe("MSIX Claude Desktop uninstall", () => { const result = await runUninstall( false, - systemUninstallHost(home, undefined, env, "win32"), + claudeDesktopUninstallHost(home, env), ); expect(result.status).toBe("complete");