This commit is contained in:
Presley Pizzo
2022-10-19 03:37:51 +00:00
parent 2efe49b4ca
commit 950ac50193
@@ -1,4 +1,5 @@
import { screen } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
import { rest } from "msw"
import * as CreateDayString from "util/createDayString"
import { Language as WorkspacesTableBodyLanguage } from "../../components/WorkspacesTable/WorkspacesTableBody"
@@ -39,4 +40,14 @@ describe("WorkspacesPage", () => {
// Then
await screen.findByText(MockWorkspace.name)
})
it("navigates to the next page of workspaces", async () => {
const user = userEvent.setup()
const { container } = render(<WorkspacesPage />)
const nextPage = await screen.findByRole("button", { name: "Next page" })
expect(nextPage).toBeEnabled()
await user.click(nextPage)
const pageButtons = await container.querySelectorAll(`button[name="Page button"]`)
expect(pageButtons.length).toBe(2)
})
})