Skip to content

Commit

Permalink
zhuzh search results test
Browse files Browse the repository at this point in the history
  • Loading branch information
charmingduchess committed Dec 2, 2024
1 parent cd265c6 commit 155e423
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion __test__/pages/bib/bibPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("Bib Page with items", () => {
})

// TODO: Determine if this should be rendering twice
it.only("renders the bottom bib details", () => {
it("renders the bottom bib details", () => {
expect(screen.getAllByTestId("publication-date")[0]).toHaveTextContent(
"Vol. 1, issue 1-"
)
Expand Down
7 changes: 3 additions & 4 deletions __test__/pages/search/searchResults.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import userEvent from "@testing-library/user-event"
import { render, screen } from "../../../src/utils/testUtils"
import { render, screen, waitFor } from "../../../src/utils/testUtils"

import mockRouter from "next-router-mock"

Expand Down Expand Up @@ -32,11 +32,10 @@ describe("Search Results page", () => {
})
await userEvent.click(field)
await userEvent.click(screen.getByText("Apply filters"))
// This was the only way to get this test to pass. waitFor was not in fact waiting, even with same timeout.
setTimeout(() => {
waitFor(() => {
const resultsHeading = screen.getByTestId("search-results-heading")
expect(resultsHeading).toHaveFocus()
}, 500)
})
})
it("focuses on search results heading after loading a keyword search", () => {
mockRouter.push(`/search?q=${query}`)
Expand Down

0 comments on commit 155e423

Please sign in to comment.