@@ -123,7 +123,9 @@ describe("openFile", () => {
123123 expect ( console . warn ) . not . toHaveBeenCalled ( )
124124
125125 // Should use the decoded path - verify it contains the decoded brackets
126- expect ( vscode . Uri . file ) . toHaveBeenCalledWith ( expect . stringContaining ( "[test]/file.txt" ) )
126+ // On Windows, the path will include backslashes instead of forward slashes
127+ const expectedPathSegment = process . platform === "win32" ? "[test]\\file.txt" : "[test]/file.txt"
128+ expect ( vscode . Uri . file ) . toHaveBeenCalledWith ( expect . stringContaining ( expectedPathSegment ) )
127129 expect ( vscode . workspace . openTextDocument ) . toHaveBeenCalled ( )
128130 expect ( vscode . window . showErrorMessage ) . not . toHaveBeenCalled ( )
129131 } )
@@ -226,8 +228,10 @@ describe("openFile", () => {
226228
227229 await openFile ( newFilePath , { create : true , content } )
228230
231+ // On Windows, the path will include backslashes instead of forward slashes
232+ const expectedPathSegment = process . platform === "win32" ? "new\\file.txt" : "new/file.txt"
229233 expect ( vscode . workspace . fs . writeFile ) . toHaveBeenCalledWith (
230- expect . objectContaining ( { fsPath : expect . stringContaining ( "new/file.txt" ) } ) ,
234+ expect . objectContaining ( { fsPath : expect . stringContaining ( expectedPathSegment ) } ) ,
231235 Buffer . from ( content , "utf8" ) ,
232236 )
233237 expect ( vscode . workspace . openTextDocument ) . toHaveBeenCalled ( )
0 commit comments