mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: update test mocks to handle async getState() calls in Task constructor
- Added missing vscode.workspace.onDidChangeWorkspaceFolders mock - Added missing vscode.Uri mock - Added missing vscode.RelativePattern mock - Fixed mockProvider.getState to return a Promise in Dynamic Strategy Selection tests These changes fix the failing tests that were caused by the new async code added to retrieve the openTabsAtEndOfList setting in the Task constructor.
This commit is contained in:
parent
31c9f70afd
commit
94e8d57721
1 changed files with 21 additions and 1 deletions
|
|
@ -116,6 +116,7 @@ vi.mock("vscode", () => {
|
|||
stat: vi.fn().mockResolvedValue({ type: 1 }), // FileType.File = 1
|
||||
},
|
||||
onDidSaveTextDocument: vi.fn(() => mockDisposable),
|
||||
onDidChangeWorkspaceFolders: vi.fn(() => mockDisposable),
|
||||
getConfiguration: vi.fn(() => ({ get: (key: string, defaultValue: any) => defaultValue })),
|
||||
},
|
||||
env: {
|
||||
|
|
@ -127,6 +128,25 @@ vi.mock("vscode", () => {
|
|||
from: vi.fn(),
|
||||
},
|
||||
TabInputText: vi.fn(),
|
||||
Uri: {
|
||||
file: vi.fn((path: string) => ({
|
||||
fsPath: path,
|
||||
scheme: "file",
|
||||
authority: "",
|
||||
path,
|
||||
query: "",
|
||||
fragment: "",
|
||||
})),
|
||||
parse: vi.fn((str: string) => ({
|
||||
fsPath: str,
|
||||
scheme: "file",
|
||||
authority: "",
|
||||
path: str,
|
||||
query: "",
|
||||
fragment: "",
|
||||
})),
|
||||
},
|
||||
RelativePattern: vi.fn().mockImplementation((base, pattern) => ({ base, pattern })),
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -1313,7 +1333,7 @@ describe("Cline", () => {
|
|||
context: {
|
||||
globalStorageUri: { fsPath: "/test/storage" },
|
||||
},
|
||||
getState: vi.fn(),
|
||||
getState: vi.fn().mockResolvedValue({}),
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue