fix: update searchAndReplaceTool tests to match implementation

- Remove expectation for recordToolUsage call (metrics are recorded by presentAssistantMessage)
- Fix handleError assertion to use 'edit_file_anthropic' instead of 'search and replace'
This commit is contained in:
Hannes Rudolph 2025-12-23 18:40:26 -07:00
parent 448f7691d4
commit d2f5dfd24c

View file

@ -331,7 +331,7 @@ describe("searchAndReplaceTool", () => {
expect(mockTask.diffViewProvider.saveChanges).toHaveBeenCalled()
expect(mockTask.didEditFile).toBe(true)
expect(mockTask.recordToolUsage).toHaveBeenCalledWith("edit_file_anthropic")
// Tool usage metrics are recorded by presentAssistantMessage(), not in the tool itself
})
it("reverts changes when user rejects", async () => {
@ -390,7 +390,7 @@ describe("searchAndReplaceTool", () => {
await executeSearchAndReplaceTool()
expect(mockHandleError).toHaveBeenCalledWith("search and replace", expect.any(Error))
expect(mockHandleError).toHaveBeenCalledWith("edit_file_anthropic", expect.any(Error))
expect(mockTask.diffViewProvider.reset).toHaveBeenCalled()
})
})