test(cli): refactor tests for async render utilities (#23252)

This commit is contained in:
Tommaso Sciortino
2026-03-20 20:08:29 +00:00
committed by GitHub
parent 86a3a913b5
commit 6c78eb7a39
198 changed files with 3592 additions and 4802 deletions
@@ -36,10 +36,9 @@ describe('ShowMoreLines', () => {
ReturnType<typeof useOverflowState>
>);
mockUseStreamingContext.mockReturnValue(streamingState);
const { lastFrame, waitUntilReady, unmount } = render(
const { lastFrame, unmount } = await render(
<ShowMoreLines constrainHeight={constrainHeight} />,
);
await waitUntilReady();
expect(lastFrame({ allowEmpty: true })).toBe('');
unmount();
},
@@ -51,10 +50,9 @@ describe('ShowMoreLines', () => {
overflowingIds: new Set(['1']),
} as NonNullable<ReturnType<typeof useOverflowState>>);
mockUseStreamingContext.mockReturnValue(StreamingState.Idle);
const { lastFrame, waitUntilReady, unmount } = render(
const { lastFrame, unmount } = await render(
<ShowMoreLines constrainHeight={true} />,
);
await waitUntilReady();
expect(lastFrame().toLowerCase()).toContain(
'press ctrl+o to show more lines',
);
@@ -73,10 +71,9 @@ describe('ShowMoreLines', () => {
overflowingIds: new Set(['1']),
} as NonNullable<ReturnType<typeof useOverflowState>>);
mockUseStreamingContext.mockReturnValue(streamingState);
const { lastFrame, waitUntilReady, unmount } = render(
const { lastFrame, unmount } = await render(
<ShowMoreLines constrainHeight={true} />,
);
await waitUntilReady();
expect(lastFrame().toLowerCase()).toContain(
'press ctrl+o to show more lines',
);
@@ -90,10 +87,9 @@ describe('ShowMoreLines', () => {
overflowingIds: new Set(),
} as NonNullable<ReturnType<typeof useOverflowState>>);
mockUseStreamingContext.mockReturnValue(StreamingState.Idle);
const { lastFrame, waitUntilReady, unmount } = render(
const { lastFrame, unmount } = await render(
<ShowMoreLines constrainHeight={true} isOverflowing={true} />,
);
await waitUntilReady();
expect(lastFrame().toLowerCase()).toContain(
'press ctrl+o to show more lines',
);
@@ -105,10 +101,9 @@ describe('ShowMoreLines', () => {
overflowingIds: new Set(['1']),
} as NonNullable<ReturnType<typeof useOverflowState>>);
mockUseStreamingContext.mockReturnValue(StreamingState.Idle);
const { lastFrame, waitUntilReady, unmount } = render(
const { lastFrame, unmount } = await render(
<ShowMoreLines constrainHeight={true} isOverflowing={false} />,
);
await waitUntilReady();
expect(lastFrame({ allowEmpty: true })).toBe('');
unmount();
});