Files
orca/src/shared/runtime-navigation.test.ts
T
Neil 6a9ba9d733 Keep remote worktree creation from navigating paired clients (#25793)
* fix(workspaces): keep remote creation from navigating paired viewers

* fix(workspaces): revoke pending navigation after connection replacement

* fix(workspaces): provision when the host renderer is unavailable

* test: align navigation and cache-scan expectations with current behavior

* fix(workspaces): provision broadcast creates without a host renderer
2026-10-06 00:38:53 -07:00

39 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { resolveRuntimeNavigationTarget } from './runtime-navigation'
describe('runtime navigation authority', () => {
it('denies paired-client fanout for legacy payloads', () => {
expect(resolveRuntimeNavigationTarget({ clientKind: 'runtime', notifyClients: true })).toBe(
'caller'
)
expect(resolveRuntimeNavigationTarget({ clientKind: 'mobile', notifyClients: true })).toBe(
'caller'
)
})
it('preserves legacy in-process routing and explicit intent', () => {
expect(resolveRuntimeNavigationTarget({ notifyClients: true })).toBe('all')
expect(resolveRuntimeNavigationTarget({ notifyClients: false })).toBe('caller')
expect(
resolveRuntimeNavigationTarget({
clientKind: 'runtime',
notifyClients: false,
navigation: 'host'
})
).toBe('host')
})
it('lets worktree operations default to the host without overriding paired or explicit intent', () => {
expect(resolveRuntimeNavigationTarget({ defaultTarget: 'host' })).toBe('host')
expect(resolveRuntimeNavigationTarget({ defaultTarget: 'host', notifyClients: false })).toBe(
'caller'
)
expect(resolveRuntimeNavigationTarget({ defaultTarget: 'host', clientKind: 'runtime' })).toBe(
'caller'
)
expect(resolveRuntimeNavigationTarget({ defaultTarget: 'host', navigation: 'clients' })).toBe(
'clients'
)
})
})