Skip to content

Commit

Permalink
test: Footer Component
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunjae95 committed Nov 2, 2024
1 parent e0bd2b2 commit 3e385a5
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/components/Footer/Footer.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { render, screen } from "@testing-library/react";
import { expect, test } from "vitest";
import Footer from "./Footer";

test("render left menu", () => {
render(<Footer />);

[
{
label: "FAQ",
link: "https://github.com/DaleStudy/leetcode-study/discussions",
},
{
label: "Apply",
link: "https://github.com/DaleStudy/leetcode-study/discussions/209",
},
{
label: "Guide",
link: "https://github.com/DaleStudy/leetcode-study/blob/main/CONTRIBUTING.md",
},
].forEach(({ label, link }) => {
const childMenu = screen.getByRole("link", { name: label });
expect(childMenu).toHaveAttribute("href", link);
});
});

test("render right menu", () => {
render(<Footer />);

[
{
label: "Blog",
link: "https://www.algodale.com",
},
{
label: "LinkedIn",
link: "https://www.linkedin.com/in/daleseo",
},
{
label: "Github",
link: "https://github.com/DaleStudy/leetcode-study",
},
{
label: "Youtube",
link: "https://www.youtube.com/@DaleSeo",
},
].forEach(({ label, link }) => {
const childMenu = screen.getByRole("link", { name: label });
expect(childMenu).toHaveAttribute("href", link);
});
});

test("render copyright", () => {
render(<Footer />);

const copyright = screen.getByText("© 2024 DaleStudy. All rights reserved.");
expect(copyright).toBeInTheDocument();
});

0 comments on commit 3e385a5

Please sign in to comment.