From e024900e3808b9765bbfcc255a16e75c94731357 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Mon, 30 Mar 2026 18:40:56 -0700 Subject: [PATCH] test: remove redundant theatrical assertions (#3120) Remove bare toHaveBeenCalled() checks that preceded stronger content assertions, and strengthen the "shows manual install command" test to verify the actual install script URL appears in output. Affected files: - cmd-update-cov: remove redundant consoleSpy.toHaveBeenCalled() (x2), strengthen "shows manual install command" to check install.sh content - update-check: remove redundant consoleErrorSpy.toHaveBeenCalled() (x2) that were immediately followed by .mock.calls content assertions - recursive-spawn: remove redundant logInfoSpy.toHaveBeenCalled() before content check - cmd-interactive: remove redundant mockIntro/mockOutro.toHaveBeenCalled() before content checks Co-authored-by: spawn-qa-bot Co-authored-by: Claude Sonnet 4.6 --- packages/cli/src/__tests__/cmd-interactive.test.ts | 2 -- packages/cli/src/__tests__/cmd-update-cov.test.ts | 9 +++++---- packages/cli/src/__tests__/recursive-spawn.test.ts | 1 - packages/cli/src/__tests__/update-check.test.ts | 2 -- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/__tests__/cmd-interactive.test.ts b/packages/cli/src/__tests__/cmd-interactive.test.ts index 079ae2c3..9de87601 100644 --- a/packages/cli/src/__tests__/cmd-interactive.test.ts +++ b/packages/cli/src/__tests__/cmd-interactive.test.ts @@ -279,7 +279,6 @@ describe("cmdInteractive", () => { await cmdInteractive(); - expect(mockIntro).toHaveBeenCalled(); const introArg = mockIntro.mock.calls[0]?.[0] ?? ""; expect(introArg).toContain("spawn"); }); @@ -345,7 +344,6 @@ describe("cmdInteractive", () => { await cmdInteractive(); - expect(mockOutro).toHaveBeenCalled(); const outroArg = mockOutro.mock.calls[0]?.[0] ?? ""; expect(outroArg).toContain("spawn script"); }); diff --git a/packages/cli/src/__tests__/cmd-update-cov.test.ts b/packages/cli/src/__tests__/cmd-update-cov.test.ts index 10323490..93214890 100644 --- a/packages/cli/src/__tests__/cmd-update-cov.test.ts +++ b/packages/cli/src/__tests__/cmd-update-cov.test.ts @@ -204,8 +204,6 @@ describe("cmdUpdate", () => { runUpdate: updateFn, }); - // consoleSpy (console.log) should have been called - expect(consoleSpy).toHaveBeenCalled(); expect(clack.logInfo).toHaveBeenCalledWith(expect.stringContaining("Run spawn again")); }); @@ -220,7 +218,10 @@ describe("cmdUpdate", () => { runUpdate: updateFn, }); - // Should show the install command - expect(consoleSpy).toHaveBeenCalled(); + expect(clack.logError).toHaveBeenCalledWith(expect.stringContaining("Auto-update failed")); + const allLoggedLines = consoleSpy.mock.calls.map((c: unknown[]) => String(c[0] ?? "")); + expect(allLoggedLines.some((line: string) => line.includes("install.sh") || line.includes("install.ps1"))).toBe( + true, + ); }); }); diff --git a/packages/cli/src/__tests__/recursive-spawn.test.ts b/packages/cli/src/__tests__/recursive-spawn.test.ts index f653a0f4..e9fb14af 100644 --- a/packages/cli/src/__tests__/recursive-spawn.test.ts +++ b/packages/cli/src/__tests__/recursive-spawn.test.ts @@ -401,7 +401,6 @@ describe("recursive spawn", () => { await cmdTree(); - expect(logInfoSpy).toHaveBeenCalled(); const calls = logInfoSpy.mock.calls.map((args) => String(args[0])); expect(calls.some((msg) => msg.includes("No spawn history found"))).toBe(true); logInfoSpy.mockRestore(); diff --git a/packages/cli/src/__tests__/update-check.test.ts b/packages/cli/src/__tests__/update-check.test.ts index 64e27605..87d97c4d 100644 --- a/packages/cli/src/__tests__/update-check.test.ts +++ b/packages/cli/src/__tests__/update-check.test.ts @@ -119,7 +119,6 @@ describe("update-check", () => { await checkForUpdates(); // Should have printed update message to stderr - expect(consoleErrorSpy).toHaveBeenCalled(); const output = consoleErrorSpy.mock.calls.map((call) => call[0]).join("\n"); expect(output).toContain("Update available"); expect(output).toContain("99.0.0"); @@ -181,7 +180,6 @@ describe("update-check", () => { await checkForUpdates(); // Should have printed error message - expect(consoleErrorSpy).toHaveBeenCalled(); const output = consoleErrorSpy.mock.calls.map((call) => call[0]).join("\n"); expect(output).toContain("Auto-update failed");