Skip to content

Commit

Permalink
test: update test for delete_workspace_modal
Browse files Browse the repository at this point in the history
Signed-off-by: tygao <tygao@amazon.com>
  • Loading branch information
raintygao committed Mar 8, 2024
1 parent 5128962 commit bf286b0
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
});
Expand Down Expand Up @@ -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();
});
Expand Down Expand Up @@ -264,8 +264,5 @@ describe('DeleteWorkspaceModal', () => {
fireEvent.click(confirmButton);
expect(deleteFn).toHaveBeenCalledWith('test');
expect(coreStartMock.notifications.toasts.addDanger).toHaveBeenCalled();
waitFor(() => {
expect(onCloseFn).toHaveBeenCalled();
});
});
});

0 comments on commit bf286b0

Please sign in to comment.