Files
archived-orca/src/main/git/command-runner/git-command-timeout.test.ts
T
Neil 328caa2160 fix(git): reduce queries and preserve data across execution hosts (#24602)
* fix(git): reduce queries and preserve data across execution hosts

* fix(ci): exercise pinned Git and serialize mobile dependency entrypoints

* fix(relay): preserve fresh diff retries after hung shared reads

* test(git): wait for fetch barrier before canceling preparation

* fix(i18n): describe index-preserving discard in every locale

* fix(git): retain clone diagnostics and allow WSL policy startup

* test(git): refresh default-base and branch-safety fixtures
2026-10-02 18:05:37 -07:00

33 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { GitCommandTimeoutError, gitCommandTimeoutMs } from './git-command-timeout'
describe('gitCommandTimeoutMs', () => {
it.each([
[['status', '--porcelain=v2'], 120_000],
[['show', 'HEAD:file'], 120_000],
[['diff-tree', '--root', '-r', 'HEAD'], 120_000],
[['fetch', 'origin'], undefined],
[['checkout', 'main'], undefined],
[['unknown'], undefined]
] as const)('selects the fail-safe default for %j', (args, expected) => {
expect(gitCommandTimeoutMs(args, undefined)).toBe(expected)
})
it('preserves every explicit timeout', () => {
expect(gitCommandTimeoutMs(['status'], 7)).toBe(7)
expect(gitCommandTimeoutMs(['fetch'], 7)).toBe(7)
})
it('provides a deterministic read-timeout seam', () => {
expect(gitCommandTimeoutMs(['status'], undefined, 25)).toBe(25)
})
})
describe('GitCommandTimeoutError', () => {
it('is typed and retains its deadline', () => {
const error = new GitCommandTimeoutError(25)
expect(error).toBeInstanceOf(Error)
expect(error).toMatchObject({ name: 'GitCommandTimeoutError', timeoutMs: 25 })
})
})