update lastFrame

This commit is contained in:
uinstinct 2025-12-03 18:41:19 +05:30
parent 50f38286c2
commit 3db6091dc5
2 changed files with 18 additions and 9 deletions

View file

@ -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();

View file

@ -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");