Files
oh-my-pi/packages/coding-agent/test/output-block.test.ts
T
HvC 28d9de74ce Implement Windows Sixel support and terminal capability checks (#241)
* windows sixel imp

* windows sixel imp, terminal capability check, pessimistic sixel selection

* fix codex suggestions

---------

Co-authored-by: Brit <lol@no.com>
2026-03-01 22:23:05 +01:00

39 lines
1.2 KiB
TypeScript

import { afterEach, describe, expect, it } from "bun:test";
import { getThemeByName } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
import { renderOutputBlock } from "@oh-my-pi/pi-coding-agent/tui/output-block";
import { ImageProtocol, TERMINAL } from "@oh-my-pi/pi-tui";
type MutableTerminalInfo = {
imageProtocol: ImageProtocol | null;
};
const terminal = TERMINAL as unknown as MutableTerminalInfo;
describe("renderOutputBlock", () => {
const originalProtocol = TERMINAL.imageProtocol;
afterEach(() => {
terminal.imageProtocol = originalProtocol;
});
it("passes SIXEL lines through without trimming or padding", async () => {
terminal.imageProtocol = ImageProtocol.Sixel;
const theme = await getThemeByName("dark");
expect(theme).toBeDefined();
const uiTheme = theme!;
const sixel = "\x1bPqabc\x1b\\";
const lines = renderOutputBlock(
{
width: 40,
sections: [{ label: "Output", lines: ["regular line", sixel] }],
},
uiTheme,
);
expect(lines.filter(line => line === sixel)).toHaveLength(1);
const regularLine = lines.find(line => line.includes("regular line"));
expect(regularLine).toBeDefined();
expect(regularLine).not.toBe("regular line");
});
});