Skip to content

Commit

Permalink
fix: fixed tests for Some error occurred
Browse files Browse the repository at this point in the history
  • Loading branch information
dianasavvatina committed Dec 6, 2024
1 parent b3ef307 commit 9347052
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion apps/web/src/components/SendFlow/Tez/FormPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ describe("<Form />", () => {
const submitButton = screen.getByText("Preview");
await waitFor(() => expect(submitButton).toBeEnabled());
const estimateMock = jest.mocked(estimate);
estimateMock.mockRejectedValue(new Error("Some error occurred"));
expect(mockToast).toHaveBeenCalledWith({
description:
"Something went wrong. Please try again or contact support if the issue persists.",
status: "error",
isClosable: true,
});

await act(() => user.click(submitButton));

Expand Down
10 changes: 8 additions & 2 deletions apps/web/src/components/SendFlow/Undelegation/FormPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,21 @@ describe("<Form />", () => {
);

const estimateMock = jest.mocked(estimate);
estimateMock.mockRejectedValue(new Error("Some error occurred"));
expect(mockToast).toHaveBeenCalledWith({
description:
"Something went wrong. Please try again or contact support if the issue persists.",
status: "error",
isClosable: true,
});

const submitButton = screen.getByText("Preview");
await waitFor(() => expect(submitButton).toBeEnabled());
await act(() => user.click(submitButton));

expect(estimateMock).toHaveBeenCalledTimes(1);
expect(mockToast).toHaveBeenCalledWith({
description: "Some error occurred",
description:
"Something went wrong. Please try again or contact support if the issue persists.",
status: "error",
isClosable: true,
});
Expand Down

0 comments on commit 9347052

Please sign in to comment.