Skip to content

Commit

Permalink
Add tests for model service navigation (#4350)
Browse files Browse the repository at this point in the history
  • Loading branch information
steverydz authored Jul 25, 2023
1 parent 0e96acb commit 1ab9d0a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions static/js/brand-store/components/Model/ModelNav.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import { BrowserRouter } from "react-router-dom";
import { render, screen } from "@testing-library/react";
import "@testing-library/jest-dom";

import ModelNav from "./ModelNav";

const renderComponent = () => {
return render(
<BrowserRouter>
<ModelNav sectionName="policies" />
</BrowserRouter>
);
};

describe("ModelNav", () => {
it("highlights the correct navigation item", () => {
renderComponent();
const currentLink = screen.getByRole("tab", { name: "Policies" });
expect(currentLink.getAttribute("aria-selected")).toBe("true");
});

it("doesn't highlight other navigation links", () => {
renderComponent();
const currentLink = screen.getByRole("tab", { name: "Overview" });
expect(currentLink.getAttribute("aria-selected")).toBe("false");
});
});

0 comments on commit 1ab9d0a

Please sign in to comment.