Files
oh-my-pi/packages/coding-agent/test/modes/controllers/input-controller-tool-expansion.test.ts
T
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00

28 lines
1.2 KiB
TypeScript

import { describe, expect, it, vi } from "bun:test";
import { InputController } from "@oh-my-pi/pi-coding-agent/modes/controllers/input-controller";
import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types";
describe("InputController tool output expansion", () => {
it("expands children and forces a full display reset to bypass frozen snapshots", () => {
const expandable = { setExpanded: vi.fn() };
const inert = { render: vi.fn(() => []) };
const requestRender = vi.fn();
const resetDisplay = vi.fn();
const ctx = {
toolOutputExpanded: false,
chatContainer: { children: [expandable, inert] },
ui: { requestRender, resetDisplay },
} as unknown as InteractiveModeContext;
new InputController(ctx).toggleToolOutputExpansion();
expect(ctx.toolOutputExpanded).toBe(true);
expect(expandable.setExpanded).toHaveBeenCalledWith(true);
// resetDisplay() is the only path that retires the transcript's frozen
// block snapshots and re-emits the whole transcript at its new heights.
// A plain requestRender would replay the stale (collapsed) snapshots.
expect(resetDisplay).toHaveBeenCalledTimes(1);
expect(requestRender).not.toHaveBeenCalled();
});
});