diff --git a/packages/cli/src/__tests__/cmd-link-cov.test.ts b/packages/cli/src/__tests__/cmd-link-cov.test.ts index c0faaa1e..8f940195 100644 --- a/packages/cli/src/__tests__/cmd-link-cov.test.ts +++ b/packages/cli/src/__tests__/cmd-link-cov.test.ts @@ -163,39 +163,6 @@ describe("cmdLink (additional coverage)", () => { expect(clack.logError).toHaveBeenCalledWith(expect.stringContaining("Invalid SSH user")); }); - it("saves record in non-interactive mode (skips confirm)", async () => { - const { loadHistory } = await import("../history.js"); - - await cmdLink( - [ - "link", - "1.2.3.4", - "--agent", - "claude", - "--cloud", - "hetzner", - "--user", - "root", - ], - { - tcpCheck: TCP_REACHABLE, - sshCommand: SSH_NO_DETECT, - }, - ); - - // Non-interactive mode skips confirm and saves directly - expect(clack.logSuccess).toHaveBeenCalledWith(expect.stringContaining("Deployment linked")); - const records = loadHistory(); - const thisRecord = records.find( - (r: { - connection?: { - ip?: string; - }; - }) => r.connection?.ip === "1.2.3.4", - ); - expect(thisRecord).toBeDefined(); - }); - it("uses short flags for cloud and agent", async () => { const { loadHistory } = await import("../history.js"); @@ -274,24 +241,6 @@ describe("cmdLink (additional coverage)", () => { expect(clack.logError).toHaveBeenCalledWith(expect.stringContaining("not reachable")); }); - it("exits with error for invalid IP address", async () => { - const consoleSpy = spyOn(console, "error").mockImplementation(() => {}); - await asyncTryCatch(() => - cmdLink( - [ - "link", - "not-an-ip!@#", - ], - { - tcpCheck: TCP_REACHABLE, - sshCommand: SSH_NO_DETECT, - }, - ), - ); - expect(processExitSpy).toHaveBeenCalledWith(1); - consoleSpy.mockRestore(); - }); - it("runs detection spinner when cloud not provided", async () => { await cmdLink( [ @@ -311,36 +260,4 @@ describe("cmdLink (additional coverage)", () => { const spinnerCalls = clack.spinnerStart.mock.calls.map((c: unknown[]) => String(c[0])); expect(spinnerCalls.some((msg: string) => msg.includes("Auto-detecting"))).toBe(true); }); - - it("generates default name from agent and IP when no --name flag", async () => { - const { loadHistory } = await import("../history.js"); - - await cmdLink( - [ - "link", - "10.0.0.1", - "--agent", - "claude", - "--cloud", - "hetzner", - "--user", - "root", - ], - { - tcpCheck: TCP_REACHABLE, - sshCommand: SSH_NO_DETECT, - }, - ); - - const records = loadHistory(); - const rec = records.find( - (r: { - connection?: { - ip?: string; - }; - }) => r.connection?.ip === "10.0.0.1", - ); - expect(rec).toBeDefined(); - expect(rec?.name).toBe("claude-10-0-0-1"); - }); });