Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.2 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import { isHostedTaskRepo, reconcileRepoSelection } from './hosted-repo-selection'

const repos = [
  { id: 'a', kind: 'worktree' },
  { id: 'b', kind: 'worktree' },
  { id: 'folder', kind: 'folder' }
]

describe('isHostedTaskRepo', () => {
  it('excludes folder workspaces and keeps everything else', () => {
    expect(repos.filter(isHostedTaskRepo).map((repo) => repo.id)).toEqual(['a', 'b'])
    expect(isHostedTaskRepo({ id: 'no-kind' })).toBe(true)
  })
})

describe('reconcileRepoSelection', () => {
  it('treats an absent or empty persisted selection as "all repos"', () => {
    expect(reconcileRepoSelection(repos, null)).toEqual(new Set())
    expect(reconcileRepoSelection(repos, [])).toEqual(new Set())
  })

  it('drops ids this host no longer has', () => {
    expect(reconcileRepoSelection(repos, ['a', 'gone'])).toEqual(new Set(['a']))
  })

  it('widens back to all repos when nothing in the selection survives', () => {
    expect(reconcileRepoSelection(repos, ['gone'])).toEqual(new Set())
  })

  it('never selects a folder workspace', () => {
    expect(reconcileRepoSelection(repos, ['folder'])).toEqual(new Set())
  })
})