Skip to content

Commit 6174b4f

Browse files
committed
Fix tests
1 parent bb2f0f3 commit 6174b4f

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

site/src/components/PaginationWidget/PaginationWidget.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type PaginationWidgetProps = {
2727
const range = (start: number, stop: number, step = 1) =>
2828
Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step)
2929

30-
export const DEFAULT_RECORDS_PER_PAGE = 2
30+
export const DEFAULT_RECORDS_PER_PAGE = 25
3131
// Number of pages to the left or right of the current page selection.
3232
const PAGE_NEIGHBORS = 1
3333
// Number of pages displayed for cases where there are multiple ellipsis showing. This can be

site/src/pages/WorkspacePage/WorkspacePage.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ describe("WorkspacePage", () => {
220220

221221
await waitFor(() =>
222222
expect(api.startWorkspace).toBeCalledWith(
223-
"test-workspace",
223+
"test-outdated-workspace",
224224
"test-template-version",
225225
),
226226
)

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

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { screen } from "@testing-library/react"
2-
import userEvent from "@testing-library/user-event"
1+
import { screen, waitFor } from "@testing-library/react"
32
import { rest } from "msw"
43
import * as CreateDayString from "util/createDayString"
54
import { Language as WorkspacesTableBodyLanguage } from "../../components/WorkspacesTable/WorkspacesTableBody"
@@ -35,21 +34,19 @@ describe("WorkspacesPage", () => {
3534

3635
it("renders a filled workspaces page", async () => {
3736
// When
38-
render(<WorkspacesPage />)
37+
const { container } = render(<WorkspacesPage />)
3938

4039
// Then
41-
await screen.findByText(MockWorkspace.name)
42-
})
43-
44-
it("navigates to the next page of workspaces", async () => {
45-
const user = userEvent.setup()
46-
const { container } = render(<WorkspacesPage />)
4740
const nextPage = await screen.findByRole("button", { name: "Next page" })
4841
expect(nextPage).toBeEnabled()
49-
await user.click(nextPage)
50-
const pageButtons = await container.querySelectorAll(
51-
`button[name="Page button"]`,
52-
)
53-
expect(pageButtons.length).toBe(2)
42+
await waitFor(async () => {
43+
const prevPage = await screen.findByRole("button", { name: "Previous page" })
44+
expect(prevPage).toBeDisabled()
45+
const pageButtons = await container.querySelectorAll(
46+
`button[name="Page button"]`,
47+
)
48+
expect(pageButtons.length).toBe(2)
49+
}, { timeout: 2000 })
50+
await screen.findByText(MockWorkspace.name)
5451
})
5552
})

site/src/xServices/deploymentFlags/deploymentFlagsMachine.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { createMachine, assign } from "xstate"
55
export const deploymentFlagsMachine = createMachine(
66
{
77
id: "deploymentFlagsMachine",
8+
predictableActionArguments: true,
89
initial: "idle",
910
schema: {
1011
context: {} as {

0 commit comments

Comments
 (0)