Files
ide/test/test.installer.node.ts
T
2026-05-10 14:08:25 +00:00

51 lines
1.7 KiB
TypeScript

import { tap, expect } from '@git.zone/tstest/tapbundle';
import {
createRemoteBootstrapCommand,
createRemoteInstallCommand,
createRemoteServerInstallPlan,
joinRemotePath,
quoteShellArg,
} from '../packages/server-installer/ts/index.js';
tap.test('should create stable remote install paths', async () => {
const plan = createRemoteServerInstallPlan({
serverVersion: '0.1.0',
artifactName: 'remote-theia-linux-x64.tgz',
installRoot: '~/.git.zone/ide-server',
platform: 'linux',
arch: 'x64',
});
expect(plan.paths.versionRoot).toEqual('~/.git.zone/ide-server/0.1.0');
expect(plan.paths.currentLink).toEqual('~/.git.zone/ide-server/current');
expect(plan.manifest.protocolVersion).toEqual(1);
expect(plan.manifest.artifactName).toEqual('remote-theia-linux-x64.tgz');
});
tap.test('should quote shell arguments safely', async () => {
expect(quoteShellArg("that's it")).toEqual("'that'\"'\"'s it'");
expect(joinRemotePath('~/.git.zone/', '/ide-server/', '/0.1.0')).toEqual('~/.git.zone/ide-server/0.1.0');
});
tap.test('should render install and bootstrap commands', async () => {
const plan = createRemoteServerInstallPlan({
serverVersion: '0.1.0',
artifactName: 'remote-theia.tgz',
});
const installCommand = createRemoteInstallCommand(plan);
const bootstrapCommand = createRemoteBootstrapCommand({
serverVersion: '0.1.0',
workspacePath: '/srv/work/project',
theiaPort: 33990,
opencodePort: 4096,
opencodeUsername: 'opencode',
opencodePassword: 'secret',
});
expect(installCommand).toInclude('GITZONE_IDE_MANIFEST');
expect(bootstrapCommand).toInclude('GITZONE_IDE_OPENCODE_PORT');
expect(bootstrapCommand).toInclude('pnpm --dir');
});
export default tap.start();