fix: add missing Uri and RelativePattern exports to VSCode mock in MCP tests

- Added Uri.file mock function to return proper Uri-like objects
- Added RelativePattern mock constructor
- Fixes test failures where McpHub.ts uses vscode.Uri.file() and vscode.RelativePattern
- All MCP tests now pass (24/24)
This commit is contained in:
Roo Code 2025-07-13 15:27:55 +00:00
parent 36ff031d72
commit ebcb23d321

View file

@ -62,6 +62,22 @@ vi.mock("vscode", () => ({
dispose: vi.fn(),
}),
},
Uri: {
file: vi.fn((path: string) => ({
scheme: "file",
authority: "",
path: path,
query: "",
fragment: "",
fsPath: path,
with: vi.fn(),
toJSON: vi.fn(),
})),
},
RelativePattern: vi.fn().mockImplementation((base: string, pattern: string) => ({
base,
pattern,
})),
Disposable: {
from: vi.fn(),
},
@ -93,7 +109,6 @@ describe("McpHub", () => {
// Mock console.error to suppress error messages during tests
console.error = vi.fn()
const mockUri: Uri = {
scheme: "file",
authority: "",