Skip to content

Commit 12fe3d8

Browse files
committed
Fix test
1 parent e689179 commit 12fe3d8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

site/src/modules/notifications/NotificationsInbox/NotificationsInbox.stories.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { expect, fn, userEvent, within } from "@storybook/test";
2+
import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
33
import { MockNotifications, mockApiError } from "testHelpers/entities";
44
import { withGlobalSnackbar } from "testHelpers/storybook";
55
import { NotificationsInbox } from "./NotificationsInbox";
@@ -51,9 +51,7 @@ export const FailAndRetry: Story = {
5151
return fn(async () => {
5252
count += 1;
5353

54-
// Fail on the first 3 attempts
55-
// 3 is the maximum number of retries from react-query
56-
if (count < 3) {
54+
if (count === 1) {
5755
throw mockApiError({
5856
message: "Failed to load notifications",
5957
});
@@ -74,9 +72,11 @@ export const FailAndRetry: Story = {
7472

7573
const retryButton = body.getByRole("button", { name: /retry/i });
7674
await userEvent.click(retryButton);
77-
await expect(
78-
body.queryByText("Error loading notifications"),
79-
).not.toBeInTheDocument();
75+
await waitFor(() => {
76+
expect(
77+
body.queryByText("Error loading notifications"),
78+
).not.toBeInTheDocument();
79+
});
8080
},
8181
};
8282

0 commit comments

Comments
 (0)