fix: make insertContentTool test platform-agnostic for Windows CI

This commit is contained in:
Daniel Riccio 2025-07-08 10:17:29 -05:00
parent 94cfdf622f
commit 10e8e203f7
No known key found for this signature in database
GPG key ID: FFD5FD825F8E8209

View file

@ -12,7 +12,7 @@ vi.mock("path", async () => {
const originalPath = await vi.importActual("path")
return {
...originalPath,
resolve: vi.fn().mockImplementation((...args) => args.join("/")),
resolve: vi.fn(),
}
})
@ -54,6 +54,7 @@ vi.mock("../../ignore/RooIgnoreController", () => ({
describe("insertContentTool", () => {
const testFilePath = "test/file.txt"
// Use a consistent mock absolute path for testing
const absoluteFilePath = "/test/file.txt"
const mockedFileExistsAtPath = fileExistsAtPath as MockedFunction<typeof fileExistsAtPath>
@ -70,6 +71,7 @@ describe("insertContentTool", () => {
beforeEach(() => {
vi.clearAllMocks()
// Mock path.resolve to return our test absolute path
mockedPathResolve.mockReturnValue(absoluteFilePath)
mockedFileExistsAtPath.mockResolvedValue(true) // Assume file exists by default for insert
mockedFsReadFile.mockResolvedValue("") // Default empty file content