mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
fix: update test mocks to support diagnostic settings in tool tests
- Add providerRef mock to insertContentTool and writeToFileTool tests - Update mocks to include diagnosticsEnabled and diagnosticsDelayMs settings - Fix test expectations to match new implementation with diagnostic configuration - Resolves failing unit tests for insertContentTool.spec.ts and writeToFileTool.spec.ts
This commit is contained in:
parent
a1e7983ff2
commit
53e828ba8b
2 changed files with 17 additions and 1 deletions
|
|
@ -71,6 +71,14 @@ describe("insertContentTool", () => {
|
|||
cwd: "/",
|
||||
consecutiveMistakeCount: 0,
|
||||
didEditFile: false,
|
||||
providerRef: {
|
||||
deref: vi.fn().mockReturnValue({
|
||||
getState: vi.fn().mockResolvedValue({
|
||||
diagnosticsEnabled: true,
|
||||
diagnosticsDelayMs: 2000,
|
||||
}),
|
||||
}),
|
||||
},
|
||||
rooIgnoreController: {
|
||||
validateAccess: vi.fn().mockReturnValue(true),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -132,6 +132,14 @@ describe("writeToFileTool", () => {
|
|||
mockCline.consecutiveMistakeCount = 0
|
||||
mockCline.didEditFile = false
|
||||
mockCline.diffStrategy = undefined
|
||||
mockCline.providerRef = {
|
||||
deref: vi.fn().mockReturnValue({
|
||||
getState: vi.fn().mockResolvedValue({
|
||||
diagnosticsEnabled: true,
|
||||
diagnosticsDelayMs: 2000,
|
||||
}),
|
||||
}),
|
||||
}
|
||||
mockCline.rooIgnoreController = {
|
||||
validateAccess: vi.fn().mockReturnValue(true),
|
||||
}
|
||||
|
|
@ -376,7 +384,7 @@ describe("writeToFileTool", () => {
|
|||
userEdits: userEditsValue,
|
||||
finalContent: "modified content",
|
||||
})
|
||||
// Manually set the property on the mock instance because the original saveChanges is not called
|
||||
// Set the userEdits property on the diffViewProvider mock to simulate user edits
|
||||
mockCline.diffViewProvider.userEdits = userEditsValue
|
||||
|
||||
await executeWriteFileTool({}, { fileExists: true })
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue