From d91f99c854060c0d22d4229ac070f7ac4f2d3782 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 19 Jul 2025 16:47:39 -0700 Subject: [PATCH] fix tests by waiting for indexing --- src/ui/__tests__/TUIChat.fileSearch.test.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ui/__tests__/TUIChat.fileSearch.test.tsx b/src/ui/__tests__/TUIChat.fileSearch.test.tsx index 669080c29..b42c79fb5 100644 --- a/src/ui/__tests__/TUIChat.fileSearch.test.tsx +++ b/src/ui/__tests__/TUIChat.fileSearch.test.tsx @@ -10,10 +10,15 @@ describe("TUIChat - @ File Search Tests", () => { // Type the @ character to trigger file search stdin.write("@"); - // Wait for file search to initialize and display files - await new Promise((resolve) => setTimeout(resolve, 100)); + const indexingFrame = lastFrame()!; + expect(indexingFrame).toContain("Indexing files..."); - const frame = lastFrame()!; + // Wait until indexing is complete + let frame; + do { + await new Promise((resolve) => setTimeout(resolve, 100)); + frame = lastFrame()!; + } while (frame.includes("Indexing files...")); // Should show file search UI with files expect(frame).toContain("@");