Skip to content

Commit f5fe8e8

Browse files
committed
Fix cancel tests
1 parent 7d6a03f commit f5fe8e8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

site/src/pages/UsersPage/CreateUserPage/CreateUserPage.test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,16 @@ describe("Create User Page", () => {
7575
expect(successMessage).toBeDefined()
7676
expect(history.location.pathname).toEqual("/users")
7777
})
78-
it("redirects to users page on cancel", () => {
78+
it("redirects to users page on cancel", async () => {
7979
render(<CreateUserPage />)
80-
screen.findByText(FooterLanguage.cancelLabel)
80+
const cancelButton = await screen.findByText(FooterLanguage.cancelLabel)
81+
act(() => cancelButton.click())
8182
expect(history.location.pathname).toEqual("/users")
8283
})
83-
it("redirects to users page on close", () => {
84+
it("redirects to users page on close", async () => {
8485
render(<CreateUserPage />)
85-
screen.findByText("ESC")
86+
const closeButton = await screen.findByText("ESC")
87+
act(() => closeButton.click())
8688
expect(history.location.pathname).toEqual("/users")
8789
})
8890
})

0 commit comments

Comments
 (0)