mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 17:37:40 +00:00
28 lines
939 B
TypeScript
28 lines
939 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { findProjectHostSetup } from './project-host-setup-target'
|
|
|
|
const local = { id: 'repo-1', hostId: 'local' as const, repoId: 'repo-1' }
|
|
const ssh = { id: 'repo-1', hostId: 'ssh:box' as const, repoId: 'repo-1' }
|
|
|
|
describe('findProjectHostSetup', () => {
|
|
it('picks the named twin', () => {
|
|
expect(
|
|
findProjectHostSetup([local, ssh], {
|
|
setupId: 'repo-1',
|
|
hostId: 'ssh:box'
|
|
})
|
|
).toBe(ssh)
|
|
})
|
|
|
|
it('never falls back to a sibling when the named twin is gone', () => {
|
|
expect(findProjectHostSetup([local], { setupId: 'repo-1', hostId: 'ssh:box' })).toBeUndefined()
|
|
})
|
|
|
|
it('refuses a wrongly named host for an independent setup', () => {
|
|
const provisioned = { id: 'p::gpu', hostId: 'local' as const, repoId: '' }
|
|
expect(
|
|
findProjectHostSetup([provisioned], { setupId: 'p::gpu', hostId: 'ssh:other' })
|
|
).toBeUndefined()
|
|
})
|
|
})
|