mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-16 23:41:06 +00:00
feat(ZooMigration): add test for extension already installed
This commit is contained in:
parent
e6c6688024
commit
1be8a40884
2 changed files with 26 additions and 4 deletions
|
|
@ -202,10 +202,13 @@ export async function showZooMigrationNotice(
|
|||
export async function installOrShowZooExtension(): Promise<void> {
|
||||
try {
|
||||
await vscode.commands.executeCommand("workbench.extensions.installExtension", ZOO_EXTENSION_ID)
|
||||
} catch {
|
||||
await vscode.commands.executeCommand("workbench.extensions.search", ZOO_EXTENSION_ID)
|
||||
await vscode.window.showInformationMessage(t("common:zooMigration.installUnavailable"))
|
||||
}
|
||||
if (vscode.extensions.getExtension(ZOO_EXTENSION_ID)) {
|
||||
return
|
||||
}
|
||||
} catch {}
|
||||
|
||||
await vscode.commands.executeCommand("workbench.extensions.search", ZOO_EXTENSION_ID)
|
||||
await vscode.window.showInformationMessage(t("common:zooMigration.installUnavailable"))
|
||||
}
|
||||
|
||||
export async function promptAndCreateZooMigrationHandoff(options: {
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ describe("installOrShowZooExtension", () => {
|
|||
|
||||
it("installs the published Zoo Code marketplace extension", async () => {
|
||||
const executeCommand = vi.spyOn(vscode.commands, "executeCommand").mockResolvedValue(undefined)
|
||||
vi.spyOn(vscode.extensions, "getExtension").mockReturnValue({} as any)
|
||||
|
||||
await installOrShowZooExtension()
|
||||
|
||||
|
|
@ -214,6 +215,7 @@ describe("installOrShowZooExtension", () => {
|
|||
"workbench.extensions.installExtension",
|
||||
"ZooCodeOrganization.zoo-code",
|
||||
)
|
||||
expect(executeCommand).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it("falls back to extension search when the configured gallery cannot install Zoo Code yet", async () => {
|
||||
|
|
@ -233,6 +235,23 @@ describe("installOrShowZooExtension", () => {
|
|||
expect(executeCommand).toHaveBeenNthCalledWith(2, "workbench.extensions.search", "ZooCodeOrganization.zoo-code")
|
||||
expect(showInformationMessage).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("falls back to extension search when install resolves without installing Zoo Code", async () => {
|
||||
const executeCommand = vi.spyOn(vscode.commands, "executeCommand").mockResolvedValue(undefined)
|
||||
vi.spyOn(vscode.extensions, "getExtension").mockReturnValue(undefined)
|
||||
const showInformationMessage = vi.spyOn(vscode.window, "showInformationMessage").mockResolvedValue(undefined)
|
||||
|
||||
await installOrShowZooExtension()
|
||||
|
||||
expect(executeCommand).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
"workbench.extensions.installExtension",
|
||||
"ZooCodeOrganization.zoo-code",
|
||||
)
|
||||
expect(vscode.extensions.getExtension).toHaveBeenCalledWith("ZooCodeOrganization.zoo-code")
|
||||
expect(executeCommand).toHaveBeenNthCalledWith(2, "workbench.extensions.search", "ZooCodeOrganization.zoo-code")
|
||||
expect(showInformationMessage).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
function makeContext(globalStoragePath: string): vscode.ExtensionContext {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue