Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ndv99 committed Nov 8, 2023
1 parent fa26f46 commit 8c67f7c
Showing 1 changed file with 34 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ describe("GlobalSideNav", () => {
state,
});

const primaryNavigation = screen.getByRole("navigation");
const primaryNavigation = screen.getByRole("banner", {
name: "main navigation",
});
expect(within(primaryNavigation).getAllByRole("link")).toHaveLength(1);
expect(
within(primaryNavigation).getAllByRole("link")[0]
Expand Down Expand Up @@ -135,7 +137,7 @@ describe("GlobalSideNav", () => {
state,
});

const mainNav = screen.getByRole("navigation");
const mainNav = screen.getByRole("banner", { name: "main navigation" });
expect(within(mainNav).getAllByRole("link")[0]).toHaveAccessibleName(
"Homepage"
);
Expand Down Expand Up @@ -270,14 +272,20 @@ describe("GlobalSideNav", () => {
state,
});
expect(
within(screen.getByRole("navigation")).getByRole("link", {
name: "Homepage",
})
within(screen.getByRole("banner", { name: "main navigation" })).getByRole(
"link",
{
name: "Homepage",
}
)
).toHaveAttribute("href", "/dashboard");
expect(
within(screen.getByRole("banner")).getByRole("link", {
name: "Homepage",
})
within(screen.getByRole("banner", { name: "main navigation" })).getByRole(
"link",
{
name: "Homepage",
}
)
).toHaveAttribute("href", "/dashboard");
});

Expand All @@ -289,14 +297,20 @@ describe("GlobalSideNav", () => {
});

expect(
within(screen.getByRole("navigation")).getByRole("link", {
name: "Homepage",
})
within(screen.getByRole("banner", { name: "main navigation" })).getByRole(
"link",
{
name: "Homepage",
}
)
).toHaveAttribute("href", "/machines");
expect(
within(screen.getByRole("banner")).getByRole("link", {
name: "Homepage",
})
within(screen.getByRole("banner", { name: "main navigation" })).getByRole(
"link",
{
name: "Homepage",
}
)
).toHaveAttribute("href", "/machines");
});

Expand Down Expand Up @@ -374,7 +388,9 @@ describe("GlobalSideNav", () => {
state,
});

expect(screen.getByRole("navigation")).toHaveClass("is-collapsed");
expect(screen.getByRole("banner", { name: "main navigation" })).toHaveClass(
"is-collapsed"
);
});

it("persists collapsed state", async () => {
Expand All @@ -384,7 +400,9 @@ describe("GlobalSideNav", () => {
state,
});

const primaryNavigation = screen.getByRole("navigation");
const primaryNavigation = screen.getByRole("banner", {
name: "main navigation",
});
await userEvent.click(
screen.getByRole("button", { name: "expand main navigation" })
);
Expand Down

0 comments on commit 8c67f7c

Please sign in to comment.