mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge remote-tracking branch 'origin/main' into sbc_add_subtasks
This commit is contained in:
commit
d4f0f53be8
1 changed files with 22 additions and 1 deletions
|
|
@ -38,6 +38,16 @@ jest.mock("../../contextProxy", () => {
|
|||
saveChanges: jest.fn().mockResolvedValue(undefined),
|
||||
dispose: jest.fn().mockResolvedValue(undefined),
|
||||
hasPendingChanges: jest.fn().mockReturnValue(false),
|
||||
setValue: jest.fn().mockImplementation((key, value) => {
|
||||
if (key.startsWith("apiKey") || key.startsWith("openAiApiKey")) {
|
||||
return context.secrets.store(key, value)
|
||||
}
|
||||
return context.globalState.update(key, value)
|
||||
}),
|
||||
setValues: jest.fn().mockImplementation((values) => {
|
||||
const promises = Object.entries(values).map(([key, value]) => context.globalState.update(key, value))
|
||||
return Promise.all(promises)
|
||||
}),
|
||||
})),
|
||||
}
|
||||
})
|
||||
|
|
@ -273,6 +283,8 @@ describe("ClineProvider", () => {
|
|||
let mockContextProxy: {
|
||||
updateGlobalState: jest.Mock
|
||||
getGlobalState: jest.Mock
|
||||
setValue: jest.Mock
|
||||
setValues: jest.Mock
|
||||
storeSecret: jest.Mock
|
||||
dispose: jest.Mock
|
||||
}
|
||||
|
|
@ -1555,6 +1567,7 @@ describe("ContextProxy integration", () => {
|
|||
let mockContext: vscode.ExtensionContext
|
||||
let mockOutputChannel: vscode.OutputChannel
|
||||
let mockContextProxy: any
|
||||
let mockGlobalStateUpdate: jest.Mock
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset mocks
|
||||
|
|
@ -1562,7 +1575,11 @@ describe("ContextProxy integration", () => {
|
|||
|
||||
// Setup basic mocks
|
||||
mockContext = {
|
||||
globalState: { get: jest.fn(), update: jest.fn(), keys: jest.fn().mockReturnValue([]) },
|
||||
globalState: {
|
||||
get: jest.fn(),
|
||||
update: jest.fn(),
|
||||
keys: jest.fn().mockReturnValue([]),
|
||||
},
|
||||
secrets: { get: jest.fn(), store: jest.fn(), delete: jest.fn() },
|
||||
extensionUri: {} as vscode.Uri,
|
||||
globalStorageUri: { fsPath: "/test/path" },
|
||||
|
|
@ -1574,6 +1591,8 @@ describe("ContextProxy integration", () => {
|
|||
|
||||
// @ts-ignore - accessing private property for testing
|
||||
mockContextProxy = provider.contextProxy
|
||||
|
||||
mockGlobalStateUpdate = mockContext.globalState.update as jest.Mock
|
||||
})
|
||||
|
||||
test("updateGlobalState uses contextProxy", async () => {
|
||||
|
|
@ -1598,5 +1617,7 @@ describe("ContextProxy integration", () => {
|
|||
expect(mockContextProxy.getGlobalState).toBeDefined()
|
||||
expect(mockContextProxy.updateGlobalState).toBeDefined()
|
||||
expect(mockContextProxy.storeSecret).toBeDefined()
|
||||
expect(mockContextProxy.setValue).toBeDefined()
|
||||
expect(mockContextProxy.setValues).toBeDefined()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue