Files
archived-orca/src/main/git/command-runner/runner-buffer-stdin.test.ts
T
Neil a0f1cb0ee2 refactor(git): group root modules by concrete domain owners (#41322)
* refactor(git): group root modules by concrete domain owners

* chore(git): reconcile retired-test metadata with owner cleanup
2026-11-11 18:02:15 -08:00

26 lines
938 B
TypeScript

import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, expect, it } from 'vitest'
import { gitExecFileAsync, gitExecFileAsyncBuffer } from './git-exec-file'
const roots: string[] = []
afterEach(async () => {
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })))
})
it('delivers stdin to buffered Git reads', async () => {
const repository = await mkdtemp(join(tmpdir(), 'orca-git-buffer-stdin-'))
roots.push(repository)
await gitExecFileAsync(['init', '--quiet'], { cwd: repository })
// Why a short timeout: a dropped stdin leaves Git waiting for EOF instead of failing.
const { stdout } = await gitExecFileAsyncBuffer(['hash-object', '--stdin'], {
cwd: repository,
stdin: 'hello\n',
timeout: 10_000
})
expect(stdout.toString().trim()).toBe('ce013625030ba8dba906f756967f9e9ca394464a')
})