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
@@ -95,8 +95,7 @@ describe('SearchableList', () => {
};
it('should render all items initially', async () => {
const { lastFrame, waitUntilReady } = await renderList();
await waitUntilReady();
const { lastFrame } = await renderList();
const frame = lastFrame();
expect(frame).toContain('Test List');
@@ -109,10 +108,9 @@ describe('SearchableList', () => {
});
it('should reset selection to top when items change if resetSelectionOnItemsChange is true', async () => {
const { lastFrame, stdin, waitUntilReady } = await renderList({
const { lastFrame, stdin } = await renderList({
resetSelectionOnItemsChange: true,
});
await waitUntilReady();
await React.act(async () => {
stdin.write('\u001B[B'); // Down arrow
@@ -218,8 +216,7 @@ describe('SearchableList', () => {
});
it('should match snapshot', async () => {
const { lastFrame, waitUntilReady } = await renderList();
await waitUntilReady();
const { lastFrame } = await renderList();
expect(lastFrame()).toMatchSnapshot();
});
});