92ec2550d2
- 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.
27 lines
784 B
TypeScript
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);
|
|
});
|
|
});
|