Files
orca/src/main/usage-worktree-metadata.test.ts
T
Neil 7b83b2dcdc fix: avoid repeated macOS privacy prompts (#1524)
* fix: avoid repeated macos privacy prompts

* fix: reduce background worktree permission probes

* chore: pin oxlint for ci

* fix: preserve optional rpc params with zod 4.4

* fix: preserve optional inline rpc params with zod 4.4
2026-05-06 23:30:03 -07:00

55 lines
1.4 KiB
TypeScript

import { describe, expect, it, vi } from 'vitest'
import { loadKnownUsageWorktreesByRepo } from './usage-worktree-metadata'
describe('loadKnownUsageWorktreesByRepo', () => {
it('builds usage worktree refs from repo roots and persisted metadata', () => {
const store = {
getAllWorktreeMeta: vi.fn(() => ({
'repo-1::/workspace/repo-a-feature': {
displayName: 'Feature A'
},
'repo-2::/remote/repo-b-feature': {
displayName: 'Remote feature'
},
malformed: {
displayName: 'Ignored'
}
}))
}
const repos = [
{
id: 'repo-1',
path: '/workspace/repo-a',
displayName: 'Repo A'
},
{
id: 'repo-2',
path: '/remote/repo-b',
displayName: 'Remote Repo',
connectionId: 'ssh-1'
}
]
expect(loadKnownUsageWorktreesByRepo(store as never, repos as never)).toEqual(
new Map([
[
'repo-1',
[
{
worktreeId: 'repo-1::/workspace/repo-a',
path: '/workspace/repo-a',
displayName: 'Repo A'
},
{
worktreeId: 'repo-1::/workspace/repo-a-feature',
path: '/workspace/repo-a-feature',
displayName: 'Feature A'
}
]
]
])
)
expect(store.getAllWorktreeMeta).toHaveBeenCalledTimes(1)
})
})