From 4de17847807fb95348db363fae8b81c1c232f1e4 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 19 Jul 2025 23:05:31 -0700 Subject: [PATCH] fix: macos test --- src/ui/__tests__/TUIChat.input.test.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ui/__tests__/TUIChat.input.test.tsx b/src/ui/__tests__/TUIChat.input.test.tsx index ce3184e92..401b60a99 100644 --- a/src/ui/__tests__/TUIChat.input.test.tsx +++ b/src/ui/__tests__/TUIChat.input.test.tsx @@ -17,15 +17,21 @@ describe("TUIChat - User Input Tests", () => { }); it("clears input field after pressing Enter", async () => { - const { lastFrame, stdin } = render(); + const { lastFrame, stdin, rerender } = render(); stdin.write("Test message"); const beforeEnter = lastFrame(); stdin.write("\r"); - // Wait for the UI to update after pressing enter - await new Promise((resolve) => setTimeout(resolve, 50)); + // Wait for the async message processing and UI updates + await new Promise((resolve) => setTimeout(resolve, 200)); + + // Force a rerender to ensure the UI has updated + rerender(); + + // Give it a bit more time for the message to appear in the chat + await new Promise((resolve) => setTimeout(resolve, 100)); const afterEnter = lastFrame();