diff --git a/src/plugins/workspace/public/components/delete_workspace_modal/delete_workspace_modal.test.tsx b/src/plugins/workspace/public/components/delete_workspace_modal/delete_workspace_modal.test.tsx index 5ea21af260fe..d385ed319741 100644 --- a/src/plugins/workspace/public/components/delete_workspace_modal/delete_workspace_modal.test.tsx +++ b/src/plugins/workspace/public/components/delete_workspace_modal/delete_workspace_modal.test.tsx @@ -96,7 +96,7 @@ describe('DeleteWorkspaceModal', () => { expect(deleteFn).not.toHaveBeenCalled(); fireEvent.click(confirmButton); expect(deleteFn).toHaveBeenCalledWith('test'); - waitFor(() => { + await waitFor(() => { expect(coreStartMock.notifications.toasts.addSuccess).toHaveBeenCalled(); expect(onCloseFn).toHaveBeenCalled(); expect(coreStartMock.application.navigateToUrl).toHaveBeenCalled(); @@ -133,7 +133,7 @@ describe('DeleteWorkspaceModal', () => { const confirmButton = getByTestId('delete-workspace-modal-confirm'); fireEvent.click(confirmButton); expect(deleteFn).toHaveBeenCalledWith('test'); - waitFor(() => { + await waitFor(() => { expect(coreStartMock.notifications.toasts.addSuccess).toHaveBeenCalled(); expect(coreStartMock.application.navigateToUrl).not.toHaveBeenCalled(); }); @@ -196,7 +196,7 @@ describe('DeleteWorkspaceModal', () => { const confirmButton = getByTestId('delete-workspace-modal-confirm'); fireEvent.click(confirmButton); expect(deleteFn).toHaveBeenCalledWith('test'); - waitFor(() => { + await waitFor(() => { expect(coreStartMock.notifications.toasts.addSuccess).not.toHaveBeenCalled(); expect(coreStartMock.notifications.toasts.addDanger).toHaveBeenCalled(); }); @@ -264,8 +264,5 @@ describe('DeleteWorkspaceModal', () => { fireEvent.click(confirmButton); expect(deleteFn).toHaveBeenCalledWith('test'); expect(coreStartMock.notifications.toasts.addDanger).toHaveBeenCalled(); - waitFor(() => { - expect(onCloseFn).toHaveBeenCalled(); - }); }); });