mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Add test
This commit is contained in:
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user