-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a782551
commit 0275010
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react" | ||
import { render, screen, act } from "@testing-library/react" | ||
import userEvent from "@testing-library/user-event" | ||
import mockRouter from "next-router-mock" | ||
// this import, as well as its use on line 15 is to avoid the following error: | ||
// TypeError: Cannot use 'in' operator to search for 'beforePopState' in null | ||
import { MemoryRouterProvider } from "next-router-mock/MemoryRouterProvider" | ||
|
||
import SubNav from "./SubNav" | ||
|
||
jest.mock("next/router", () => jest.requireActual("next-router-mock")) | ||
|
||
describe("SubNav", () => { | ||
it("sends you to Subject Heading Explorer", async () => { | ||
render(<SubNav activePage="search" />, { | ||
wrapper: MemoryRouterProvider, | ||
}) | ||
const subNavLinks = screen.getAllByRole("link") | ||
expect(subNavLinks).toHaveLength(3) | ||
}) | ||
}) |