Skip to content

Commit 5c602b4

Browse files
committed
Fix test
1 parent 507f2f4 commit 5c602b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { screen } from "@testing-library/react"
1+
import { screen, waitFor } from "@testing-library/react"
22
import userEvent from "@testing-library/user-event"
33
import React from "react"
44
import { reach, StringSchema } from "yup"
@@ -42,7 +42,7 @@ describe("CreateWorkspacePage", () => {
4242
jest.spyOn(API, "createWorkspace").mockResolvedValueOnce(MockWorkspace)
4343
await fillForm({ name: "test" })
4444
// Check if the request was made
45-
expect(API.createWorkspace).haveBeenCalledTimes(1)
45+
await waitFor(() => expect(API.createWorkspace).haveBeenCalledTimes(1))
4646
// It is good to check if the API was called with the right parameters
4747
expect(API.createWorkspace).toHaveBeenCalledWith({ name: "test" })
4848
})

0 commit comments

Comments
 (0)