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
@@ -72,10 +72,9 @@ describe('PermissionsModifyTrustDialog', () => {
});
it('should render the main dialog with current trust level', async () => {
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<PermissionsModifyTrustDialog onExit={vi.fn()} addItem={vi.fn()} />,
);
await waitUntilReady();
await waitFor(() => {
expect(lastFrame()).toContain('Modify Trust Level');
@@ -96,10 +95,9 @@ describe('PermissionsModifyTrustDialog', () => {
commitTrustLevelChange: mockCommitTrustLevelChange,
isFolderTrustEnabled: true,
});
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<PermissionsModifyTrustDialog onExit={vi.fn()} addItem={vi.fn()} />,
);
await waitUntilReady();
await waitFor(() => {
expect(lastFrame()).toContain(
@@ -120,10 +118,9 @@ describe('PermissionsModifyTrustDialog', () => {
commitTrustLevelChange: mockCommitTrustLevelChange,
isFolderTrustEnabled: true,
});
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<PermissionsModifyTrustDialog onExit={vi.fn()} addItem={vi.fn()} />,
);
await waitUntilReady();
await waitFor(() => {
expect(lastFrame()).toContain(
@@ -134,10 +131,9 @@ describe('PermissionsModifyTrustDialog', () => {
});
it('should render the labels with folder names', async () => {
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<PermissionsModifyTrustDialog onExit={vi.fn()} addItem={vi.fn()} />,
);
await waitUntilReady();
await waitFor(() => {
expect(lastFrame()).toContain('Trust this folder (dir)');
@@ -152,7 +148,6 @@ describe('PermissionsModifyTrustDialog', () => {
await renderWithProviders(
<PermissionsModifyTrustDialog onExit={onExit} addItem={vi.fn()} />,
);
await waitUntilReady();
await waitFor(() => expect(lastFrame()).not.toContain('Loading...'));
@@ -191,7 +186,6 @@ describe('PermissionsModifyTrustDialog', () => {
await renderWithProviders(
<PermissionsModifyTrustDialog onExit={onExit} addItem={vi.fn()} />,
);
await waitUntilReady();
await waitFor(() => expect(lastFrame()).not.toContain('Loading...'));
@@ -226,7 +220,6 @@ describe('PermissionsModifyTrustDialog', () => {
await renderWithProviders(
<PermissionsModifyTrustDialog onExit={onExit} addItem={vi.fn()} />,
);
await waitUntilReady();
await waitFor(() => expect(lastFrame()).not.toContain('Loading...'));