Files
orca/src/shared/runtime-environment-host-kind.test.ts
T
Neil c57e530a50 refactor(runtime-environments): one exhaustive host-kind classifier for connect, remove, call readiness, hint and phone relay (#29500)
* 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
2026-10-16 00:51:10 -07:00

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)
})
})