Skip to content

Commit

Permalink
UMA-1191: fix Menu test
Browse files Browse the repository at this point in the history
  • Loading branch information
alecat88 committed Mar 3, 2025
1 parent 7b9c039 commit 09e0c9e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/web/src/components/Menu/Menu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ let store: UmamiStore;
const account = mockImplicitAccount(0);
const password = "Qwerty123123!23vcxz";

const logoutBtnText = "Off-board & Log out";

beforeEach(() => {
store = makeStore();
addTestAccount(store, account);
Expand All @@ -73,7 +75,7 @@ describe("<Menu />", () => {
expect(screen.getByText("Save backup")).toBeVisible();
expect(screen.getByText("Apps")).toBeVisible();
expect(screen.getByText("Light mode")).toBeVisible();
expect(screen.getByText("Log out")).toBeVisible();
expect(screen.getByText(logoutBtnText)).toBeVisible();
});

it.each([
Expand All @@ -97,7 +99,7 @@ describe("<Menu />", () => {

await renderInDrawer(<Menu />, store);

await user.click(screen.getByText("Log out"));
await user.click(screen.getByText(logoutBtnText));
expect(openWith).toHaveBeenCalledWith(<LogoutModal />);
});

Expand Down Expand Up @@ -156,7 +158,7 @@ describe("<Menu />", () => {
expect(screen.queryByText("Save backup")).not.toBeInTheDocument();
expect(screen.queryByText("Apps")).not.toBeInTheDocument();
expect(screen.getByText("Light mode")).toBeVisible();
expect(screen.getByText("Log out")).toBeVisible();
expect(screen.getByText(logoutBtnText)).toBeVisible();
});

it("opens Add account modal when Add account button is clicked", async () => {
Expand Down Expand Up @@ -200,7 +202,7 @@ describe("<Menu />", () => {
expect(screen.getByText("Save backup")).toBeVisible();
expect(screen.getByText("Apps")).toBeVisible();
expect(screen.getByText("Light mode")).toBeVisible();
expect(screen.getByText("Log out")).toBeVisible();
expect(screen.getByText(logoutBtnText)).toBeVisible();
});

it.each([
Expand All @@ -224,7 +226,7 @@ describe("<Menu />", () => {

await renderInDrawer(<Menu />, store);

await user.click(screen.getByText("Log out"));
await user.click(screen.getByText(logoutBtnText));
expect(openWith).toHaveBeenCalledWith(<LogoutModal />);
});

Expand Down

0 comments on commit 09e0c9e

Please sign in to comment.