Skip to content

Commit fda9677

Browse files
committed
Fix test
1 parent b4306e0 commit fda9677

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

site/src/components/PaginationWidget/PaginationWidget.test.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,28 @@ import { render } from "../../testHelpers/renderHelpers"
33
import { PaginationWidget } from "./PaginationWidget"
44

55
describe("PaginatedList", () => {
6-
it("displays an accessible previous and next button regardless of the number of pages", async () => {
7-
const { container } = render(
6+
it("displays an accessible previous and next button", () => {
7+
render(
88
<PaginationWidget
99
prevLabel="Previous"
1010
nextLabel="Next"
11+
numRecords={200}
12+
numRecordsPerPage={12}
13+
activePage={1}
1114
onPrevClick={() => jest.fn()}
1215
onNextClick={() => jest.fn()}
1316
/>,
1417
)
1518

1619
expect(
17-
await screen.findByRole("button", { name: "Previous page" }),
18-
).toBeTruthy()
19-
expect(
20-
await screen.findByRole("button", { name: "Next page" }),
21-
).toBeTruthy()
22-
// Shouldn't render any pages if no records are passed in
20+
screen.getByRole("button", { name: "Previous page" }),
21+
).toBeInTheDocument()
2322
expect(
24-
await container.querySelectorAll(`button[name="Page button"]`),
25-
).toHaveLength(0)
23+
screen.getByRole("button", { name: "Next page" }),
24+
).toBeInTheDocument()
2625
})
2726

28-
it("displays the expected number of pages with one ellipsis tile", async () => {
27+
it("displays the expected number of pages with one ellipsis tile", () => {
2928
const { container } = render(
3029
<PaginationWidget
3130
prevLabel="Previous"
@@ -41,11 +40,11 @@ describe("PaginatedList", () => {
4140

4241
// 7 total spaces. 6 are page numbers, one is ellipsis
4342
expect(
44-
await container.querySelectorAll(`button[name="Page button"]`),
43+
container.querySelectorAll(`button[name="Page button"]`),
4544
).toHaveLength(6)
4645
})
4746

48-
it("displays the expected number of pages with two ellipsis tiles", async () => {
47+
it("displays the expected number of pages with two ellipsis tiles", () => {
4948
const { container } = render(
5049
<PaginationWidget
5150
prevLabel="Previous"
@@ -61,7 +60,7 @@ describe("PaginatedList", () => {
6160

6261
// 7 total spaces. 2 sets of ellipsis on either side of the active page
6362
expect(
64-
await container.querySelectorAll(`button[name="Page button"]`),
63+
container.querySelectorAll(`button[name="Page button"]`),
6564
).toHaveLength(5)
6665
})
6766
})

0 commit comments

Comments
 (0)