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.

793 B
Raw Blame
import { afterEach, expect, it, vi } from 'vitest'

afterEach(() => {
  vi.doUnmock('node:os')
  vi.resetModules()
})

it.each([
  [undefined, 2],
  [() => 6, 2],
  [() => 32, 4]
] as const)(
  'loads the scheduler with parallelism API %s and capacity %i',
  async (api, capacity) => {
    vi.resetModules()
    vi.doMock('node:os', () => ({ availableParallelism: api }))
    const { GENERAL_CAP, GitAdmissionScheduler } = await import('./git-admission-scheduler.js')
    expect(GENERAL_CAP).toBe(capacity)
    const scheduler = new GitAdmissionScheduler()
    const grant = await scheduler.acquire({ args: ['status'], cwd: '/repo' })
    expect(scheduler.snapshot().budgets.general.baseUsed).toBe(1)
    grant.release()
    expect(scheduler.snapshot().budgets.general.baseUsed).toBe(0)
  }
)