diff --git a/site/src/pages/UsersPage/UsersPage.test.tsx b/site/src/pages/UsersPage/UsersPage.test.tsx
index 4deb0c3c3c6ec..0021c2d680220 100644
--- a/site/src/pages/UsersPage/UsersPage.test.tsx
+++ b/site/src/pages/UsersPage/UsersPage.test.tsx
@@ -179,6 +179,33 @@ describe("UsersPage", () => {
})
describe("suspend user", () => {
+ describe("when it is success", () => {
+ it("shows a success message and refresh the page", async () => {
+ render(
+ <>
+
+
+ >,
+ )
+
+ await suspendUser(() => {
+ jest.spyOn(API, "suspendUser").mockResolvedValueOnce(MockUser)
+ jest
+ .spyOn(API, "getUsers")
+ .mockImplementationOnce(() => Promise.resolve([MockUser, MockUser2]))
+ })
+
+ // Check if the success message is displayed
+ screen.findByText(usersXServiceLanguage.suspendUserSuccess)
+
+ // Check if the API was called correctly
+ expect(API.suspendUser).toBeCalledTimes(1)
+ expect(API.suspendUser).toBeCalledWith(MockUser.id)
+
+ // Check if the users list was reload
+ await waitFor(() => expect(API.getUsers).toBeCalledTimes(1))
+ })
+ })
describe("when it fails", () => {
it("shows an error message", async () => {
render(