From 3db6091dc5db43338141f719cbf75a1bf43ea6ae Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Wed, 3 Dec 2025 18:41:19 +0530 Subject: [PATCH] update lastFrame --- .../ui/__tests__/TUIChat.fileSearch.test.tsx | 20 ++++++++++++------- .../__tests__/TUIChat.slashCommands.test.tsx | 7 +++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx b/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx index fbed0423a..b469b2725 100644 --- a/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx +++ b/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx @@ -34,16 +34,20 @@ describe("TUIChat - @ File Search Tests", () => { // Type @ followed by text to filter files stdin.write("@READ"); - const frame = lastFrame()!; + let frame = lastFrame(); - waitForCondition(() => lastFrame()!.includes("@READ")); + await waitForCondition(() => { + frame = lastFrame(); + return frame?.includes("@READ") ?? false; + }); + expect(frame).toBeDefined(); // Should show the typed text expect(frame).toContain("@READ"); // Should show either navigation hints or at least indicate file search is working - const hasNavigationHints = frame.includes("↑/↓ to navigate"); - const hasFileSearch = frame.includes("@READ"); + const hasNavigationHints = frame!.includes("↑/↓ to navigate"); + const hasFileSearch = frame!.includes("@READ"); expect(hasNavigationHints || hasFileSearch).toBe(true); // Local mode specific UI expectations @@ -56,11 +60,13 @@ describe("TUIChat - @ File Search Tests", () => { // Type multiple @ characters stdin.write("@@test"); - // Wait for UI update - const frame = lastFrame(); + let frame = lastFrame(); - await waitForCondition(() => lastFrame()?.includes("@@test") ?? false); + await waitForCondition(() => { + frame = lastFrame(); + return frame?.includes("@@test") ?? false; + }); // Should handle multiple @ without crashing expect(frame).toBeDefined(); diff --git a/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx b/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx index b3630d2b6..6f44933b6 100644 --- a/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx +++ b/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx @@ -29,9 +29,12 @@ describe("TUIChat - Slash Commands Tests", () => { // Type /exi to trigger slash command filtering stdin.write("/exi"); - const frame = lastFrame(); + let frame = lastFrame(); - waitForCondition(() => lastFrame()?.includes("/exi") ?? false); + await waitForCondition(() => { + frame = lastFrame(); + return frame?.includes("/exi") ?? false; + }); // Should show the typed command expect(frame).toContain("/exi");