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
@@ -17,10 +17,9 @@ describe('IdeTrustChangeDialog', () => {
});
it('renders the correct message for CONNECTION_CHANGE', async () => {
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<IdeTrustChangeDialog reason="CONNECTION_CHANGE" />,
);
await waitUntilReady();
const frameText = lastFrame();
expect(frameText).toContain(
@@ -31,10 +30,9 @@ describe('IdeTrustChangeDialog', () => {
});
it('renders the correct message for TRUST_CHANGE', async () => {
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<IdeTrustChangeDialog reason="TRUST_CHANGE" />,
);
await waitUntilReady();
const frameText = lastFrame();
expect(frameText).toContain(
@@ -48,10 +46,9 @@ describe('IdeTrustChangeDialog', () => {
const debugLoggerWarnSpy = vi
.spyOn(debugLogger, 'warn')
.mockImplementation(() => {});
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<IdeTrustChangeDialog reason="NONE" />,
);
await waitUntilReady();
const frameText = lastFrame();
expect(frameText).toContain('Workspace trust has changed.');
@@ -68,7 +65,6 @@ describe('IdeTrustChangeDialog', () => {
const { stdin, waitUntilReady, unmount } = await renderWithProviders(
<IdeTrustChangeDialog reason="NONE" />,
);
await waitUntilReady();
await act(async () => {
stdin.write('r');
@@ -86,7 +82,6 @@ describe('IdeTrustChangeDialog', () => {
const { stdin, waitUntilReady, unmount } = await renderWithProviders(
<IdeTrustChangeDialog reason="CONNECTION_CHANGE" />,
);
await waitUntilReady();
await act(async () => {
stdin.write('R');
@@ -104,7 +99,6 @@ describe('IdeTrustChangeDialog', () => {
const { stdin, waitUntilReady, unmount } = await renderWithProviders(
<IdeTrustChangeDialog reason="CONNECTION_CHANGE" />,
);
await waitUntilReady();
await act(async () => {
stdin.write('a');