From 38565c58cb4379bb6ffbf58f7f332bbb10fb6a8a Mon Sep 17 00:00:00 2001 From: can1357 Date: Sat, 4 Jul 2026 14:48:41 +0200 Subject: [PATCH] test(coding-agent): updated job poll displacement tests to use TranscriptContainer - Replaced manual Container stubs with TranscriptContainer instances in test fixtures. - Updated test context initialization to utilize the actual container implementation for chat message tracking. --- .../test/job-poll-displacement.test.ts | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/packages/coding-agent/test/job-poll-displacement.test.ts b/packages/coding-agent/test/job-poll-displacement.test.ts index 4cd0dcaad..ea455343c 100644 --- a/packages/coding-agent/test/job-poll-displacement.test.ts +++ b/packages/coding-agent/test/job-poll-displacement.test.ts @@ -14,12 +14,13 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "bun: import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import { resetSettingsForTest, Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; import { ToolExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/tool-execution"; +import { TranscriptContainer } from "@oh-my-pi/pi-coding-agent/modes/components/transcript-container"; import { EventController } from "@oh-my-pi/pi-coding-agent/modes/controllers/event-controller"; import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types"; import { UiHelpers } from "@oh-my-pi/pi-coding-agent/modes/utils/ui-helpers"; import type { SessionContext } from "@oh-my-pi/pi-coding-agent/session/session-context"; -import { type Component, Container, type TUI } from "@oh-my-pi/pi-tui"; +import type { Component, TUI } from "@oh-my-pi/pi-tui"; const uiStub = { requestRender() {} } as unknown as TUI; @@ -158,7 +159,8 @@ describe("EventController displaces consecutive waiting polls", () => { }); function createFixture() { - const children: Component[] = []; + const chatContainer = new TranscriptContainer(); + const children = chatContainer.children; const pendingTools = new Map(); const ctx = { isInitialized: true, @@ -168,16 +170,7 @@ describe("EventController displaces consecutive waiting polls", () => { updateEditorTopBorder: vi.fn(), toolOutputExpanded: false, pendingTools, - chatContainer: { - children, - addChild: (component: Component) => { - children.push(component); - }, - removeChild: (component: Component) => { - const index = children.indexOf(component); - if (index !== -1) children.splice(index, 1); - }, - }, + chatContainer, session: { getToolByName: () => undefined }, showWarning: vi.fn(), viewSession: { getToolByName: () => undefined }, @@ -412,7 +405,7 @@ describe("UiHelpers.renderSessionContext collapses repeated todo snapshots", () }); it("removes the earlier todo snapshot when an assistant message replays two todo calls", () => { - const chatContainer = new Container(); + const chatContainer = new TranscriptContainer(); let helpers!: UiHelpers; const ctx = { chatContainer, @@ -487,7 +480,7 @@ describe("UiHelpers.renderSessionContext collapses repeated todo snapshots", () }); it("hands the trailing todo snapshot to the controller during mid-turn rebuild", () => { - const chatContainer = new Container(); + const chatContainer = new TranscriptContainer(); const inheritDisplaceableTodo = vi.fn(); let helpers!: UiHelpers; const ctx = {