Keep a failed Profile rules load from looking like an empty account.

This commit is contained in:
adilallo committed 2026-11-11 11:39:57 -07:00
1 parent c332b26683
commit da6388eef3
3 files changed
+39 -2

No files matched your search

+27
View File
@@ -27,6 +27,7 @@ function viewProps(
profileLgUp: true,
profileListSize: "l",
rules: [],
rulesLoaded: true,
rulesError: false,
draft: null,
showDraftCard: false,
@@ -128,6 +129,32 @@ describe("ProfilePageView", () => {
expect(onStartNewCustomRule).toHaveBeenCalledTimes(1);
});
test("keeps the No Rules card hidden when a failed load warning is dismissed", () => {
const { rerender } = render(
<ProfilePageView
{...viewProps({ rulesLoaded: false, rulesError: true })}
/>,
);
expect(screen.getByText(copy.rulesLoadBannerTitle)).toBeInTheDocument();
expect(
screen.queryByRole("heading", { name: copy.emptyCardTitle }),
).not.toBeInTheDocument();
rerender(
<ProfilePageView
{...viewProps({ rulesLoaded: false, rulesError: false })}
/>,
);
expect(
screen.queryByText(copy.rulesLoadBannerTitle),
).not.toBeInTheDocument();
expect(
screen.queryByRole("heading", { name: copy.emptyCardTitle }),
).not.toBeInTheDocument();
});
test("asks for confirmation before deleting the account", async () => {
const user = userEvent.setup();
const onOpenDeleteAccount = vi.fn();