codeburn/tests/parse-progress.test.ts
2026-04-21 00:03:49 +02:00

25 lines
800 B
TypeScript

import { describe, expect, it, vi } from 'vitest'
import { createTerminalProgressReporter } from '../src/parse-progress.js'
describe('createTerminalProgressReporter', () => {
it('renders Updating cache progress lines to stderr-compatible streams', () => {
const writes: string[] = []
const stream = {
isTTY: true,
write: vi.fn((chunk: string) => {
writes.push(chunk)
return true
}),
} as unknown as NodeJS.WriteStream
const reporter = createTerminalProgressReporter(true, stream)
reporter?.start('Updating cache', 2)
reporter?.advance('claude/session.jsonl')
reporter?.advance('codex/rollout.jsonl')
reporter?.finish()
expect(writes.join('')).toContain('Updating cache')
expect(writes.join('')).toContain('2/2')
})
})