Skip to content

Commit d1c0e7f

Browse files
committed
Make tests pass on Windows
1 parent 7315d7a commit d1c0e7f

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/services/marketplace/__tests__/MarketplaceManager.spec.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ describe("MarketplaceManager", () => {
105105
},
106106
}
107107

108-
mockFs.readFile.mockImplementation((path: any) => {
109-
if (path.includes(".roo/mcp.json")) {
108+
mockFs.readFile.mockImplementation((filePath: any) => {
109+
// Normalize path separators for cross-platform compatibility
110+
const normalizedPath = filePath.replace(/\\/g, "/")
111+
if (normalizedPath.includes(".roo/mcp.json")) {
110112
return Promise.resolve(JSON.stringify(mockMcpConfig))
111113
}
112114
return Promise.reject(new Error("ENOENT"))
@@ -130,8 +132,10 @@ describe("MarketplaceManager", () => {
130132
],
131133
}
132134

133-
mockFs.readFile.mockImplementation((path: any) => {
134-
if (path.includes(".roomodes")) {
135+
mockFs.readFile.mockImplementation((filePath: any) => {
136+
// Normalize path separators for cross-platform compatibility
137+
const normalizedPath = filePath.replace(/\\/g, "/")
138+
if (normalizedPath.includes(".roomodes")) {
135139
return Promise.resolve("mock-yaml-content")
136140
}
137141
return Promise.reject(new Error("ENOENT"))
@@ -166,11 +170,13 @@ describe("MarketplaceManager", () => {
166170
],
167171
}
168172

169-
mockFs.readFile.mockImplementation((path: any) => {
170-
if (path.includes("mcp_settings.json")) {
173+
mockFs.readFile.mockImplementation((filePath: any) => {
174+
// Normalize path separators for cross-platform compatibility
175+
const normalizedPath = filePath.replace(/\\/g, "/")
176+
if (normalizedPath.includes("mcp_settings.json")) {
171177
return Promise.resolve(JSON.stringify(mockGlobalMcp))
172178
}
173-
if (path.includes("custom_modes.yaml")) {
179+
if (normalizedPath.includes("custom_modes.yaml")) {
174180
return Promise.resolve("mock-yaml-content")
175181
}
176182
return Promise.reject(new Error("ENOENT"))
@@ -204,11 +210,13 @@ describe("MarketplaceManager", () => {
204210
],
205211
}
206212

207-
mockFs.readFile.mockImplementation((path: any) => {
208-
if (path.includes(".roo/mcp.json")) {
213+
mockFs.readFile.mockImplementation((filePath: any) => {
214+
// Normalize path separators for cross-platform compatibility
215+
const normalizedPath = filePath.replace(/\\/g, "/")
216+
if (normalizedPath.includes(".roo/mcp.json")) {
209217
return Promise.resolve(JSON.stringify(mockProjectMcp))
210218
}
211-
if (path.includes("custom_modes.yaml")) {
219+
if (normalizedPath.includes("custom_modes.yaml")) {
212220
return Promise.resolve("mock-yaml-content")
213221
}
214222
return Promise.reject(new Error("ENOENT"))

0 commit comments

Comments
 (0)