Skip to content

Commit 950ac50

Browse files
committed
Add test
1 parent 2efe49b commit 950ac50

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { screen } from "@testing-library/react"
2+
import userEvent from "@testing-library/user-event"
23
import { rest } from "msw"
34
import * as CreateDayString from "util/createDayString"
45
import { Language as WorkspacesTableBodyLanguage } from "../../components/WorkspacesTable/WorkspacesTableBody"
@@ -39,4 +40,14 @@ describe("WorkspacesPage", () => {
3940
// Then
4041
await screen.findByText(MockWorkspace.name)
4142
})
43+
44+
it("navigates to the next page of workspaces", async () => {
45+
const user = userEvent.setup()
46+
const { container } = render(<WorkspacesPage />)
47+
const nextPage = await screen.findByRole("button", { name: "Next page" })
48+
expect(nextPage).toBeEnabled()
49+
await user.click(nextPage)
50+
const pageButtons = await container.querySelectorAll(`button[name="Page button"]`)
51+
expect(pageButtons.length).toBe(2)
52+
})
4253
})

0 commit comments

Comments
 (0)