From 7e90887e2bf448ecc1d400ec21b6a593a8099dfd Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Sun, 13 Jul 2025 22:23:24 -0700 Subject: [PATCH] fix failing tests --- extensions/vscode/package-lock.json | 7 +-- .../TipTapEditor/utils/renderPromptv1.test.ts | 11 +++++ gui/src/components/ui/Button.tsx | 2 +- gui/src/pages/gui/Chat.tsx | 8 +--- .../gui/chat-tests/EditToolScenarios.test.tsx | 46 +++++++++++++++---- .../gui/chat-tests/ParallelToolCalls.test.tsx | 14 ++++-- gui/src/redux/selectors/selectToolCalls.ts | 5 ++ gui/src/util/toolCallState.ts | 9 ++++ 8 files changed, 81 insertions(+), 21 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index e0b5bb109..35d10c3f9 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -2544,9 +2544,10 @@ "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" }, "node_modules/@types/node": { - "version": "16.18.119", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.119.tgz", - "integrity": "sha512-ia7V9a2FnhUFfetng4/sRPBMTwHZUkPFY736rb1cg9AgG7MZdR97q7/nLR9om+sq5f1la9C857E0l/nrI0RiFQ==" + "version": "16.18.126", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.126.tgz", + "integrity": "sha512-OTcgaiwfGFBKacvfwuHzzn1KLxH/er8mluiy8/uM3sGXHaRe73RrSIj01jow9t4kJEW633Ov+cOexXeiApTyAw==", + "license": "MIT" }, "node_modules/@types/node-fetch": { "version": "2.6.12", diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.test.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.test.ts index 7837e6e7d..bb47cdf3c 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.test.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.test.ts @@ -95,7 +95,15 @@ describe("get rendered v1 prompt file", () => { }); it("should render file read errors within prompt", async () => { + // Mock console.error to prevent error output during test + const originalConsoleError = console.error; + console.error = vi.fn(); + ideMessenger.responses["fileExists"] = false; + // Mock readFile to throw an error for nonexistent files + ideMessenger.responseHandlers["readFile"] = async (filepath) => { + throw new Error(`File not found: ${filepath}`); + }; const rawContent = "Content with provider {{{ nonexistent }}}"; const command = getTestPromptV1Command(rawContent); const rendered = await getRenderedV1Prompt( @@ -107,6 +115,9 @@ describe("get rendered v1 prompt file", () => { expect(rendered).toBe( `Content with provider [Error reading file "nonexistent"]\n\nUser input`, ); + + // Restore console.error + console.error = originalConsoleError; }); it("should handle multiple attachments", async () => { diff --git a/gui/src/components/ui/Button.tsx b/gui/src/components/ui/Button.tsx index 608b8d774..f0f669caa 100644 --- a/gui/src/components/ui/Button.tsx +++ b/gui/src/components/ui/Button.tsx @@ -31,7 +31,7 @@ const Button = React.forwardRef(