Skip to content

Commit

Permalink
update: development
Browse files Browse the repository at this point in the history
Signed-off-by: Vinyl-Davyl <[email protected]>
  • Loading branch information
Vinyl-Davyl committed Aug 23, 2024
1 parent ca5da09 commit bd8ec68
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/tests/components/Navbar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { render, screen } from "@testing-library/react";
import "@testing-library/jest-dom";
import Navbar from "../../components/Navbar";
import { MemoryRouter } from "react-router-dom";

const renderNavbar = () => {
render(
<MemoryRouter>
<Navbar scrollToExplore={() => {}} />
</MemoryRouter>
);
};

describe("Navbar", () => {
it("renders logo and title on small screens", () => {
render(<Navbar scrollToExplore={() => {}} />);
renderNavbar();

const logoImage = screen.getByRole("img", { name: /Template Playground/i });
expect(logoImage).toBeInTheDocument();
Expand All @@ -14,14 +23,14 @@ describe("Navbar", () => {
});

it("renders Github link on all screens", () => {
render(<Navbar scrollToExplore={() => {}} />);
renderNavbar();

const githubLink = screen.getByRole("link", { name: /Github/i });
expect(githubLink).toBeInTheDocument();
});

it("shows hover effect on menu items", () => {
render(<Navbar scrollToExplore={() => {}} />);
renderNavbar();

const homeMenuItem = screen
.getByText(/Template Playground/i)
Expand Down

0 comments on commit bd8ec68

Please sign in to comment.