Files
oh-my-pi/packages/coding-agent/test/tool-execution-args.test.ts
T
can1357 fe5d27c4a3 feat(coding-agent): removed animated shimmer border on exec blocks
- Removed sweeping bottom-edge segment from pending bash, eval, and ssh blocks; pending now shows a static accent border.
- Dropped border shimmer geometry, animate options, and related tests.
- Repurposed pending-tool 30fps redraws solely for the running task row shimmer.
2026-06-08 04:31:58 +02:00

36 lines
1.1 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from "bun:test";
import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
import type { TUI } from "@oh-my-pi/pi-tui";
import { ToolExecutionComponent } from "../src/modes/components/tool-execution";
describe("ToolExecutionComponent.updateArgs (F8 — no clone, ref-eq fast path)", () => {
let initialized = false;
afterEach(() => {
vi.useRealTimers();
vi.restoreAllMocks();
});
async function makeComponent(args: unknown) {
if (!initialized) {
await initTheme();
initialized = true;
}
const uiStub = { requestRender() {} } as unknown as TUI;
return new ToolExecutionComponent("bash", args, {}, undefined, uiStub);
}
it("does NOT call structuredClone in updateArgs (caller already owns isolation)", async () => {
const cloneSpy = vi.spyOn(globalThis, "structuredClone");
const component = await makeComponent({ command: "ls" });
cloneSpy.mockClear();
// Simulate event-controller.ts: each delta builds a fresh spread.
for (let i = 0; i < 5; i++) {
component.updateArgs({ command: `ls -l ${i}` });
}
expect(cloneSpy).not.toHaveBeenCalled();
});
});