@@ -123,8 +123,7 @@ describe("writeToFileTool", () => {
123123 let mockPushToolResult : ReturnType < typeof vi . fn >
124124 let toolResult : ToolResponse | undefined
125125
126- const getExpectedDiffPath = ( absolutePath : string , relPath : string ) =>
127- absolutePath === path . resolve ( mockCline . cwd , relPath ) ? relPath : absolutePath
126+ const expectedInsideWorkspaceDiffPath = process . platform === "win32" ? absoluteFilePath : testFilePath
128127
129128 beforeEach ( ( ) => {
130129 vi . clearAllMocks ( )
@@ -261,9 +260,7 @@ describe("writeToFileTool", () => {
261260 await executeWriteFileTool ( { } , { accessAllowed : true } )
262261
263262 expect ( mockCline . rooIgnoreController . validateAccess ) . toHaveBeenCalledWith ( absoluteFilePath )
264- expect ( mockCline . diffViewProvider . open ) . toHaveBeenCalledWith (
265- getExpectedDiffPath ( absoluteFilePath , testFilePath ) ,
266- )
263+ expect ( mockCline . diffViewProvider . open ) . toHaveBeenCalledWith ( expectedInsideWorkspaceDiffPath )
267264 } )
268265
269266 it ( "opens the absolute diff path when the resolver lands outside task.cwd" , async ( ) => {
@@ -393,9 +390,7 @@ describe("writeToFileTool", () => {
393390 await executeWriteFileTool ( { } , { fileExists : false } )
394391
395392 expect ( mockCline . consecutiveMistakeCount ) . toBe ( 0 )
396- expect ( mockCline . diffViewProvider . open ) . toHaveBeenCalledWith (
397- getExpectedDiffPath ( absoluteFilePath , testFilePath ) ,
398- )
393+ expect ( mockCline . diffViewProvider . open ) . toHaveBeenCalledWith ( expectedInsideWorkspaceDiffPath )
399394 expect ( mockCline . diffViewProvider . update ) . toHaveBeenCalledWith ( testContent , true )
400395 expect ( mockAskApproval ) . toHaveBeenCalled ( )
401396 expect ( mockCline . diffViewProvider . saveChanges ) . toHaveBeenCalled ( )
@@ -442,9 +437,7 @@ describe("writeToFileTool", () => {
442437 // Second call with same path - path is now stabilized, file operations proceed
443438 await executeWriteFileTool ( { } , { isPartial : true } )
444439 expect ( mockCline . ask ) . toHaveBeenCalled ( )
445- expect ( mockCline . diffViewProvider . open ) . toHaveBeenCalledWith (
446- getExpectedDiffPath ( absoluteFilePath , testFilePath ) ,
447- )
440+ expect ( mockCline . diffViewProvider . open ) . toHaveBeenCalledWith ( expectedInsideWorkspaceDiffPath )
448441 expect ( mockCline . diffViewProvider . update ) . toHaveBeenCalledWith ( testContent , false )
449442 } )
450443 } )
0 commit comments