Skip to content

Commit

Permalink
add unit test for Header
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocio De Santiago authored and Rocio De Santiago committed Jul 29, 2024
1 parent 71ab718 commit 4979de4
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions services/ui-src/src/components/layout/Header.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { render, screen } from "@testing-library/react";
import { RouterWrappedComponent } from "utils/testing/setupJest";
import { Header } from "components";
import { testA11y } from "utils/testing/commonTests";

const headerComponent = (
<RouterWrappedComponent>
<Header handleLogout={() => {}} />
</RouterWrappedComponent>
);

describe("<Header />", () => {
describe("Test Header", () => {
beforeEach(() => {
render(headerComponent);
});

test("Header is visible", () => {
const header = screen.getByRole("navigation");
expect(header).toBeVisible();
});

test("Logo is visible", () => {
expect(screen.getByAltText("HCBS logo")).toBeVisible();
});

test("Help button is visible", () => {
expect(screen.getByAltText("Help")).toBeVisible();
});

test("Menu button is visible", () => {
expect(screen.getByAltText("Arrow down")).toBeVisible();
});
});

testA11y(headerComponent);
});

0 comments on commit 4979de4

Please sign in to comment.