From 5a66e70203ef9153ca39ccd7587a9a9eadde016c Mon Sep 17 00:00:00 2001 From: mkorwel Date: Sat, 18 Apr 2026 02:31:12 +0000 Subject: [PATCH] test: fix ShellInputPrompt tests --- .../ui/components/ShellInputPrompt.test.tsx | 52 +++++++++++++------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/packages/cli/src/ui/components/ShellInputPrompt.test.tsx b/packages/cli/src/ui/components/ShellInputPrompt.test.tsx index 794c7beaff..a15c24ab13 100644 --- a/packages/cli/src/ui/components/ShellInputPrompt.test.tsx +++ b/packages/cli/src/ui/components/ShellInputPrompt.test.tsx @@ -50,14 +50,20 @@ describe('ShellInputPrompt', () => { it('renders nothing', async () => { const { lastFrame, unmount } = await render( , + undefined, + undefined, + true, ); expect(lastFrame({ allowEmpty: true })).toBe(''); unmount(); }); it('sends tab to pty', async () => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); const handler = mockUseKeypress.mock.calls[0][0]; @@ -72,7 +78,6 @@ describe('ShellInputPrompt', () => { sequence: '\t', }); }); - await waitUntilReady(); expect(mockWriteToPty).toHaveBeenCalledWith(1, '\t'); unmount(); @@ -82,8 +87,11 @@ describe('ShellInputPrompt', () => { ['a', 'a'], ['b', 'b'], ])('handles keypress input: %s', async (name, sequence) => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); // Get the registered handler @@ -100,7 +108,6 @@ describe('ShellInputPrompt', () => { sequence, }); }); - await waitUntilReady(); expect(mockWriteToPty).toHaveBeenCalledWith(1, sequence); unmount(); @@ -110,8 +117,11 @@ describe('ShellInputPrompt', () => { ['up', -1], ['down', 1], ])('handles scroll %s (Command.SCROLL_%s)', async (key, direction) => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); const handler = mockUseKeypress.mock.calls[0][0]; @@ -119,7 +129,6 @@ describe('ShellInputPrompt', () => { await act(async () => { handler({ name: key, shift: true, alt: false, ctrl: false, cmd: false }); }); - await waitUntilReady(); expect(mockScrollPty).toHaveBeenCalledWith(1, direction); unmount(); @@ -131,8 +140,11 @@ describe('ShellInputPrompt', () => { ])( 'handles page scroll %s (Command.PAGE_%s) with default size', async (key, expectedScroll) => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); const handler = mockUseKeypress.mock.calls[0][0]; @@ -146,7 +158,6 @@ describe('ShellInputPrompt', () => { cmd: false, }); }); - await waitUntilReady(); expect(mockScrollPty).toHaveBeenCalledWith(1, expectedScroll); unmount(); @@ -154,12 +165,15 @@ describe('ShellInputPrompt', () => { ); it('respects scrollPageSize prop', async () => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); const handler = mockUseKeypress.mock.calls[0][0]; @@ -174,7 +188,6 @@ describe('ShellInputPrompt', () => { cmd: false, }); }); - await waitUntilReady(); expect(mockScrollPty).toHaveBeenCalledWith(1, 10); // PageUp @@ -187,14 +200,16 @@ describe('ShellInputPrompt', () => { cmd: false, }); }); - await waitUntilReady(); expect(mockScrollPty).toHaveBeenCalledWith(1, -10); unmount(); }); it('does not handle input when not focused', async () => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); const handler = mockUseKeypress.mock.calls[0][0]; @@ -209,15 +224,17 @@ describe('ShellInputPrompt', () => { sequence: 'a', }); }); - await waitUntilReady(); expect(mockWriteToPty).not.toHaveBeenCalled(); unmount(); }); it('does not handle input when no active shell', async () => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); const handler = mockUseKeypress.mock.calls[0][0]; @@ -232,15 +249,17 @@ describe('ShellInputPrompt', () => { sequence: 'a', }); }); - await waitUntilReady(); expect(mockWriteToPty).not.toHaveBeenCalled(); unmount(); }); it('ignores Command.UNFOCUS_SHELL (Shift+Tab) to allow focus navigation', async () => { - const { waitUntilReady, unmount } = await render( + const { unmount } = await render( , + undefined, + undefined, + true, ); const handler = mockUseKeypress.mock.calls[0][0]; @@ -255,7 +274,6 @@ describe('ShellInputPrompt', () => { cmd: false, }); }); - await waitUntilReady(); expect(result).toBe(false); expect(mockWriteToPty).not.toHaveBeenCalled();