mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { normalizeFolderWorkspaces } from './folder-workspaces'
|
|
import type { ProjectGroup } from '../project-group-types'
|
|
|
|
const folderGroup = {
|
|
id: 'group-1',
|
|
name: 'Projects',
|
|
parentPath: '/tmp/projects',
|
|
connectionId: null
|
|
} as unknown as ProjectGroup
|
|
|
|
describe('normalizeFolderWorkspaces host attribution', () => {
|
|
it('drops a stored executionHostId instead of round-tripping it', () => {
|
|
const [workspace] = normalizeFolderWorkspaces(
|
|
[
|
|
{
|
|
id: 'ws-1',
|
|
projectGroupId: 'group-1',
|
|
name: 'Nightly',
|
|
folderPath: '/tmp/projects/nightly',
|
|
connectionId: null,
|
|
executionHostId: 'runtime:env-7'
|
|
}
|
|
],
|
|
[folderGroup]
|
|
)
|
|
|
|
// Runtime stamps name an authority the desktop store does not own and lack a generation fence; persisting them recreates #12 divergence.
|
|
expect(workspace).toBeDefined()
|
|
expect(workspace.executionHostId).toBeUndefined()
|
|
expect(Object.keys(workspace)).not.toContain('executionHostId')
|
|
})
|
|
|
|
it('keeps connectionId as the durable host pin', () => {
|
|
const [pinned] = normalizeFolderWorkspaces(
|
|
[
|
|
{
|
|
id: 'ws-2',
|
|
projectGroupId: 'group-1',
|
|
name: 'Pinned',
|
|
folderPath: '/tmp/projects/pinned',
|
|
connectionId: 'ssh-box',
|
|
executionHostId: 'local'
|
|
}
|
|
],
|
|
[folderGroup]
|
|
)
|
|
|
|
expect(pinned.connectionId).toBe('ssh-box')
|
|
expect(pinned.executionHostId).toBeUndefined()
|
|
})
|
|
})
|