From 4979de4fcb17d743a6683f016fdd57bf9ec7dd06 Mon Sep 17 00:00:00 2001 From: Rocio De Santiago Date: Mon, 29 Jul 2024 15:28:14 -0500 Subject: [PATCH] add unit test for Header --- .../src/components/layout/Header.test.tsx | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 services/ui-src/src/components/layout/Header.test.tsx diff --git a/services/ui-src/src/components/layout/Header.test.tsx b/services/ui-src/src/components/layout/Header.test.tsx new file mode 100644 index 00000000..c80b5e16 --- /dev/null +++ b/services/ui-src/src/components/layout/Header.test.tsx @@ -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 = ( + +
{}} /> + +); + +describe("
", () => { + 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); +});