From 06e5cff3425144a40b94d1cba9ce72f73fd18cc2 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph Date: Wed, 7 Jan 2026 16:42:20 -0700 Subject: [PATCH] fix: add missing mock methods to presentAssistantMessage-custom-tool test The ReadFileTool's execute method requires additional Task methods that were not mocked: - sayAndCreateMissingParamError: called when files array is empty/undefined - cwd: used for path resolution - apiConfiguration: used for protocol resolution - taskToolProtocol: used for protocol resolution - rooIgnoreController: used for access validation - fileContextTracker: used for tracking file context This fix ensures the test properly mocks all dependencies required by the ReadFileTool when invoked through presentAssistantMessage. --- .../presentAssistantMessage-custom-tool.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts b/src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts index e90646fd9a..af356e1294 100644 --- a/src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts +++ b/src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts @@ -76,6 +76,16 @@ describe("presentAssistantMessage - Custom Tool Recording", () => { }, say: vi.fn().mockResolvedValue(undefined), ask: vi.fn().mockResolvedValue({ response: "yesButtonClicked" }), + sayAndCreateMissingParamError: vi.fn().mockResolvedValue("Missing required parameter"), + cwd: "/test/workspace", + apiConfiguration: {}, + taskToolProtocol: "native", + rooIgnoreController: { + validateAccess: vi.fn().mockReturnValue(true), + }, + fileContextTracker: { + trackFileContext: vi.fn().mockResolvedValue(undefined), + }, } // Add pushToolResultToUserContent method after mockTask is created so it can reference mockTask