Files
oh-my-pi/packages/coding-agent/test/core/python-display.test.ts
T
can1357 8d144e17ec feat(coding-agent/eval): added local python-runner subprocess execution
- Replaced Python execution with a local `python -u runner.py` subprocess and NDJSON stdin/stdout framing.
- Removed shared-gateway architecture, including coordinator lifecycle APIs, `useSharedGateway` wiring, and `jupyter` CLI/actions.
- Simplified setup checks to a plain Python 3 availability probe and removed automatic dependency-install fallbacks.
- Updated kernel cancellation and display processing to use status frames, SIGINT/SIGTERM escalation, and normalized output coercion.
- Added `python-runner` integration and display tests while deleting legacy websocket and kernel lifecycle test suites.
2026-05-12 09:09:24 +02:00

40 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { renderKernelDisplay } from "@oh-my-pi/pi-coding-agent/eval/py/display";
describe("renderKernelDisplay (raw bundle shape)", () => {
it("renders status events without text output", async () => {
const { text, outputs } = await renderKernelDisplay({
"application/x-omp-status": { op: "find", count: 12, pattern: "foo" },
});
expect(text).toBe("");
expect(outputs).toEqual([{ type: "status", event: { op: "find", count: 12, pattern: "foo" } }]);
});
it("prefers text/markdown over text/plain", async () => {
const { text, outputs } = await renderKernelDisplay({
"text/markdown": "**bold**",
"text/plain": "bold",
});
expect(text).toBe("**bold**\n");
expect(outputs).toContainEqual({ type: "markdown" });
});
it("collects image/png alongside text/plain", async () => {
const { text, outputs } = await renderKernelDisplay({
"image/png": "base64data",
"text/plain": "<Figure>",
});
expect(text).toBe("<Figure>\n");
expect(outputs).toContainEqual({ type: "image", data: "base64data", mimeType: "image/png" });
});
it("emits json bundle and includes text/plain when present", async () => {
const { text, outputs } = await renderKernelDisplay({
"application/json": { ok: true },
"text/plain": "{ ok: true }",
});
expect(text).toBe("{ ok: true }\n");
expect(outputs).toEqual([{ type: "json", data: { ok: true } }]);
});
});