Skip to content

fix: replace fireEvent with userEvent #5361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fmt
  • Loading branch information
mtojek committed Dec 9, 2022
commit a34dfe4e255e7f23a5a85b739bafa3cb08f91fdd
12 changes: 3 additions & 9 deletions site/src/pages/WorkspacePage/WorkspacePage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ describe("WorkspacePage", () => {
name: "cancel action",
})

await userEvent
.setup()
.click(cancelButton)
await userEvent.setup().click(cancelButton)

expect(cancelWorkspaceMock).toBeCalled()
})
Expand All @@ -185,9 +183,7 @@ describe("WorkspacePage", () => {
await renderWorkspacePage()
const buttonText = t("actionButton.update", { ns: "workspacePage" })
const button = await screen.findByText(buttonText, { exact: true })
await userEvent
.setup()
.click(button)
await userEvent.setup().click(button)

// getTemplate is called twice: once when the machine starts, and once after the user requests to update
expect(getTemplateMock).toBeCalledTimes(2)
Expand All @@ -209,9 +205,7 @@ describe("WorkspacePage", () => {
await renderWorkspacePage()
const buttonText = t("actionButton.update", { ns: "workspacePage" })
const button = await screen.findByText(buttonText, { exact: true })
await userEvent
.setup()
.click(button)
await userEvent.setup().click(button)

await waitFor(() =>
expect(api.startWorkspace).toBeCalledWith(
Expand Down