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

View File

@@ -55,27 +55,25 @@ describe('EditorSettingsDialog', () => {
renderWithProviders(ui);
it('renders correctly', async () => {
const { lastFrame, waitUntilReady } = await renderWithProvider(
const { lastFrame } = await renderWithProvider(
<EditorSettingsDialog
onSelect={vi.fn()}
settings={mockSettings}
onExit={vi.fn()}
/>,
);
await waitUntilReady();
expect(lastFrame()).toMatchSnapshot();
});
it('calls onSelect when an editor is selected', async () => {
const onSelect = vi.fn();
const { lastFrame, waitUntilReady } = await renderWithProvider(
const { lastFrame } = await renderWithProvider(
<EditorSettingsDialog
onSelect={onSelect}
settings={mockSettings}
onExit={vi.fn()}
/>,
);
await waitUntilReady();
expect(lastFrame()).toContain('VS Code');
});
@@ -88,7 +86,6 @@ describe('EditorSettingsDialog', () => {
onExit={vi.fn()}
/>,
);
await waitUntilReady();
// Initial focus on editor
expect(lastFrame()).toContain('> Select Editor');
@@ -134,7 +131,6 @@ describe('EditorSettingsDialog', () => {
onExit={onExit}
/>,
);
await waitUntilReady();
await act(async () => {
stdin.write('\u001B'); // Escape
@@ -162,14 +158,13 @@ describe('EditorSettingsDialog', () => {
},
} as unknown as LoadedSettings;
const { lastFrame, waitUntilReady } = await renderWithProvider(
const { lastFrame } = await renderWithProvider(
<EditorSettingsDialog
onSelect={vi.fn()}
settings={settingsWithOtherScope}
onExit={vi.fn()}
/>,
);
await waitUntilReady();
const frame = lastFrame() || '';
if (!frame.includes('(Also modified')) {