Files
oh-my-pi/packages/coding-agent/test/core/streaming-output.test.ts
T
can1357 92ec2550d2 refactor(coding-agent): reorganized test files to proper test directory structure
- Moved test files from src/core to test/core directory.
- Moved test files from src/core/tools to test/tools directory.
- Moved test files from src/discovery to test/discovery directory.
- Updated import paths to reflect new test file locations.
2026-01-19 00:07:23 +01:00

27 lines
784 B
TypeScript

import { describe, expect, it } from "bun:test";
import { createOutputSink } from "../../src/core/streaming-output";
function makeLargeOutput(size: number): string {
return "x".repeat(size);
}
describe("createOutputSink", () => {
it("spills to disk and truncates large output", async () => {
const largeOutput = makeLargeOutput(60_000);
const sink = createOutputSink(10, 70_000);
const writer = sink.getWriter();
await writer.write(largeOutput);
await writer.close();
const result = sink.dump();
expect(result.truncated).toBe(true);
expect(result.fullOutputPath).toBeDefined();
expect(result.output.length).toBeLessThan(largeOutput.length);
const fullOutput = await Bun.file(result.fullOutputPath!).text();
expect(fullOutput).toBe(largeOutput);
});
});