mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 17:47:40 +00:00
* test(runtime-environments): pin connect, remove, call readiness, hint and phone relay per host kind * refactor(runtime-environments): dispatch on one exhaustive host-kind classifier * test: avoid type assertions in host-kind characterization fakes * refactor(runtime-environments): keep service-owned connect/remove in one module; tighten characterization tests * style: break, not bare return, in host service ops switches
24 lines
1.1 KiB
TypeScript
24 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { classifyRuntimeEnvironmentHost } from './runtime-environment-host-kind'
|
|
|
|
const tunnel = { sshTargetId: 't', sshTargetGeneration: 1, localPort: 1, remotePort: 2 }
|
|
const wsl = { kind: 'wsl' as const, distro: 'Ubuntu', localPort: 1, remotePort: 2 }
|
|
|
|
describe('classifyRuntimeEnvironmentHost', () => {
|
|
it.each([
|
|
['no deployment', {}],
|
|
['a null deployment', { orcadDeployment: null }],
|
|
['an SSH link saved without its kind', { orcadDeployment: tunnel }],
|
|
['an SSH link', { orcadDeployment: { kind: 'ssh' as const, ...tunnel } }]
|
|
])('treats %s as a network host', (_name, environment) => {
|
|
expect(classifyRuntimeEnvironmentHost(environment)).toEqual({ kind: 'network', environment })
|
|
})
|
|
|
|
it('treats a WSL deployment as a WSL host and hands back its link', () => {
|
|
const environment = { orcadDeployment: wsl }
|
|
const host = classifyRuntimeEnvironmentHost(environment)
|
|
expect(host).toEqual({ kind: 'wsl', environment, deployment: wsl })
|
|
expect(host.environment).toBe(environment)
|
|
})
|
|
})
|