From 48cb8187c8ca5bff264cf2edd162a1bb19398a88 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 3 Dec 2026 05:11:58 +0800 Subject: [PATCH] test(setup): share client descriptor fixtures (#16103) --- src/application/Setup.configuration.test.ts | 78 ++++++--------------- 1 file changed, 20 insertions(+), 58 deletions(-) diff --git a/src/application/Setup.configuration.test.ts b/src/application/Setup.configuration.test.ts index b93613abd94..73565b338ae 100644 --- a/src/application/Setup.configuration.test.ts +++ b/src/application/Setup.configuration.test.ts @@ -50,6 +50,20 @@ const msixClaudeDesktop = ( }, }); +const codexClient = (): SetupClient => ({ + name: "codex", + registrationProfile: supportedClientRegistrationProfile("codex"), + displayName: "Codex", + configPath: "/codex.toml", +}); + +const cursorClient = (): SetupClient => ({ + name: "cursor", + registrationProfile: supportedClientRegistrationProfile("cursor"), + displayName: "Cursor", + configPath: "/cursor.json", +}); + describe("setup workflow", () => { it("omits an aligned managed skill from an otherwise empty plan", async () => { const host = new FakeSetupHost(); @@ -113,14 +127,7 @@ describe("setup workflow", () => { it("blocks malformed client configuration before Hopper or file mutation", async () => { const host = new FakeSetupHost(); - host.clients = [ - { - name: "codex", - registrationProfile: supportedClientRegistrationProfile("codex"), - displayName: "Codex", - configPath: "/codex.toml", - }, - ]; + host.clients = [codexClient()]; host.clientInspections.set("codex", { status: "invalid", remediation: "Repair the existing TOML.", @@ -150,12 +157,7 @@ describe("setup workflow", () => { displayName: "Claude Desktop", configPath: "/claude.json", }, - { - name: "cursor", - registrationProfile: supportedClientRegistrationProfile("cursor"), - displayName: "Cursor", - configPath: "/cursor.json", - }, + cursorClient(), ]; host.clientInspections.set("claude_desktop", { status: "invalid", @@ -225,14 +227,7 @@ describe("setup workflow", () => { it("plans a client update when Hopper installation changes its desired environment", async () => { const host = new FakeSetupHost(); - host.clients = [ - { - name: "codex", - registrationProfile: supportedClientRegistrationProfile("codex"), - displayName: "Codex", - configPath: "/codex.toml", - }, - ]; + host.clients = [codexClient()]; host.clientInspections.set("codex", { status: "already_current" }); const result = await runSetup( @@ -477,20 +472,7 @@ describe("setup workflow action selection", () => { const host = new FakeSetupHost(); host.hopper = "/Applications/Hopper"; host.skill = "unchanged"; - host.clients = [ - { - name: "codex", - registrationProfile: supportedClientRegistrationProfile("codex"), - displayName: "Codex", - configPath: "/codex.toml", - }, - { - name: "cursor", - registrationProfile: supportedClientRegistrationProfile("cursor"), - displayName: "Cursor", - configPath: "/cursor.json", - }, - ]; + host.clients = [codexClient(), cursorClient()]; const result = await runSetup( { ...options(false), structured: false }, @@ -515,20 +497,7 @@ describe("setup workflow action selection", () => { host.hopper = "/Applications/Hopper"; host.skill = "unchanged"; host.clients = []; - host.availableClients = [ - { - name: "codex", - registrationProfile: supportedClientRegistrationProfile("codex"), - displayName: "Codex", - configPath: "/codex.toml", - }, - { - name: "cursor", - registrationProfile: supportedClientRegistrationProfile("cursor"), - displayName: "Cursor", - configPath: "/cursor.json", - }, - ]; + host.availableClients = [codexClient(), cursorClient()]; host.clientInspections.set("cursor", { status: "invalid", remediation: "Repair the deselected Cursor configuration.", @@ -826,14 +795,7 @@ describe("MSIX Claude Desktop setup", () => { const host = new FakeSetupHost("win32"); host.hopper = join(PROFILE, "Hopper"); host.registrationCommandBlocker = "Install REA outside the package."; - host.clients = [ - { - name: "codex", - registrationProfile: supportedClientRegistrationProfile("codex"), - displayName: "Codex", - configPath: "/codex.toml", - }, - ]; + host.clients = [codexClient()]; const blocked = await runSetup( { ...options(true), clientIds: ["codex"] },