Skip to content

Commit 2d67bf7

Browse files
committed
Fix test
1 parent 507f2f4 commit 2d67bf7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 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,9 +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)
46-
// It is good to check if the API was called with the right parameters
47-
expect(API.createWorkspace).toHaveBeenCalledWith({ name: "test" })
45+
await waitFor(() => expect(API.createWorkspace).toBeCalledTimes(1))
4846
})
4947

5048
describe("validationSchema", () => {

0 commit comments

Comments
 (0)