Files
oh-my-pi/packages/coding-agent/test/modes/controllers/input-controller-tool-expansion.test.ts
T
can1357 20d19e8002 test: replaced blind sleeps with shared fixtures and condition polling
- Shared immutable model registries and auth storage via beforeAll/afterAll.
- Swapped fixed-delay settle sleeps for predicate polling and signals.
- Stubbed network/timers to drop wall-clock waits in registry and history tests.
- Added resetDisplay invalidation tests and startup-timing breakdown lines.
2026-06-06 22:09:04 +02:00

28 lines
1.2 KiB
TypeScript

import { describe, expect, it, vi } from "bun:test";
import { InputController } from "../../../src/modes/controllers/input-controller";
import type { InteractiveModeContext } from "../../../src/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();
});
});