summaryrefslogtreecommitdiff
path: root/packages/core/src/ide/ide-installer.test.ts
diff options
context:
space:
mode:
authorchristine betts <[email protected]>2025-08-11 21:01:37 +0000
committerGitHub <[email protected]>2025-08-11 21:01:37 +0000
commit0e98641b51270f2f63ffb30902b44903d8e88383 (patch)
treeb6a96a2475115d7bc7f6dfa12a66c1d2ead7d244 /packages/core/src/ide/ide-installer.test.ts
parent4656f17524ce4f580ceb9a9a2599728739d40fdc (diff)
Add support for VSCode-like editors (#5699)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/core/src/ide/ide-installer.test.ts')
-rw-r--r--packages/core/src/ide/ide-installer.test.ts52
1 files changed, 50 insertions, 2 deletions
diff --git a/packages/core/src/ide/ide-installer.test.ts b/packages/core/src/ide/ide-installer.test.ts
index 698c3173..1afd7a36 100644
--- a/packages/core/src/ide/ide-installer.test.ts
+++ b/packages/core/src/ide/ide-installer.test.ts
@@ -24,9 +24,17 @@ describe('ide-installer', () => {
expect(installer).toBeInstanceOf(Object);
});
- it('should return null for an unknown IDE', () => {
+ it('should return an OpenVSXInstaller for "vscodium"', () => {
+ const installer = getIdeInstaller(DetectedIde.VSCodium);
+ expect(installer).not.toBeNull();
+ expect(installer).toBeInstanceOf(Object);
+ });
+
+ it('should return a DefaultIDEInstaller for an unknown IDE', () => {
const installer = getIdeInstaller('unknown' as DetectedIde);
- expect(installer).toBeNull();
+ // Assuming DefaultIDEInstaller is the fallback
+ expect(installer).not.toBeNull();
+ expect(installer).toBeInstanceOf(Object);
});
});
@@ -59,4 +67,44 @@ describe('ide-installer', () => {
});
});
});
+
+ describe('OpenVSXInstaller', () => {
+ let installer: IdeInstaller;
+
+ beforeEach(() => {
+ installer = getIdeInstaller(DetectedIde.VSCodium)!;
+ });
+
+ afterEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ describe('install', () => {
+ it('should call execSync with the correct command and return success', async () => {
+ const execSyncSpy = vi
+ .spyOn(child_process, 'execSync')
+ .mockImplementation(() => '');
+ const result = await installer.install();
+ expect(execSyncSpy).toHaveBeenCalledWith(
+ 'npx ovsx get google.gemini-cli-vscode-ide-companion',
+ { stdio: 'pipe' },
+ );
+ expect(result.success).toBe(true);
+ expect(result.message).toContain(
+ 'VS Code companion extension was installed successfully from OpenVSX',
+ );
+ });
+
+ it('should return a failure message on failed installation', async () => {
+ vi.spyOn(child_process, 'execSync').mockImplementation(() => {
+ throw new Error('Command failed');
+ });
+ const result = await installer.install();
+ expect(result.success).toBe(false);
+ expect(result.message).toContain(
+ 'Failed to install VS Code companion extension from OpenVSX',
+ );
+ });
+ });
+ });
});