Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef260fa

Browse files
authored
fix: remove flaking test (coder#3207)
1 parent 159137d commit ef260fa

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -170,34 +170,6 @@ describe("Users Page", () => {
170170
})
171171

172172
describe("suspend user", () => {
173-
describe("when it is success", () => {
174-
it("shows a success message and refresh the page", async () => {
175-
render(
176-
<>
177-
<UsersPage />
178-
<GlobalSnackbar />
179-
</>,
180-
)
181-
182-
await suspendUser(() => {
183-
jest.spyOn(API, "suspendUser").mockResolvedValueOnce(MockUser)
184-
jest
185-
.spyOn(API, "getUsers")
186-
.mockImplementationOnce(() => Promise.resolve([MockUser, MockUser2]))
187-
})
188-
189-
// Check if the success message is displayed
190-
await screen.findByText(usersXServiceLanguage.suspendUserSuccess)
191-
192-
// Check if the API was called correctly
193-
expect(API.suspendUser).toBeCalledTimes(1)
194-
expect(API.suspendUser).toBeCalledWith(MockUser.id)
195-
196-
// Check if the users list was reload
197-
await waitFor(() => expect(API.getUsers).toBeCalledTimes(1))
198-
})
199-
})
200-
201173
describe("when it fails", () => {
202174
it("shows an error message", async () => {
203175
render(

0 commit comments

Comments
 (0)