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.
This commit is contained in:
Hannes Rudolph 2026-01-07 16:42:20 -07:00
parent 26890a5c28
commit 06e5cff342

View file

@ -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