Files
oh-my-pi/packages/coding-agent/test/core/streaming-output.test.ts
T
can1357 fa2261002d refactor(coding-agent/core): migrated tool implementations from factory functions to class-based architecture
- Converted all tool implementations from factory functions to class-based architecture.
- Updated SDK exports to expose tool classes instead of create*Tool factory functions.
- Refactored tool instantiation patterns across all built-in tools and test files.
- Added proper TypeScript typing with AgentToolResult and AgentToolUpdateCallback interfaces.
2026-01-19 16:16:54 +01:00

27 lines
770 B
TypeScript

import { describe, expect, it } from "bun:test";
import { OutputSink } from "../../src/core/streaming-output";
function makeLargeOutput(size: number): string {
return "x".repeat(size);
}
describe("OutputSink", () => {
it("spills to disk and truncates large output", async () => {
const largeOutput = makeLargeOutput(60_000);
const sink = new OutputSink(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);
});
});