Skip to content

Commit 5504b5b

Browse files
committed
fix: remove outdated tests
1 parent 338cf4d commit 5504b5b

File tree

1 file changed

+0
-161
lines changed

1 file changed

+0
-161
lines changed

site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx

Lines changed: 0 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -85,167 +85,6 @@ describe("WorkspacesPage", () => {
8585
expect(deleteWorkspace).toHaveBeenCalledWith(workspaces[1].id);
8686
});
8787

88-
describe("batch update", () => {
89-
it("ignores up-to-date workspaces", async () => {
90-
const workspaces = [
91-
{ ...MockWorkspace, id: "1" }, // running, not outdated. no warning.
92-
{ ...MockDormantWorkspace, id: "2" }, // dormant, not outdated. no warning.
93-
{ ...MockOutdatedWorkspace, id: "3" },
94-
{ ...MockOutdatedWorkspace, id: "4" },
95-
];
96-
jest
97-
.spyOn(API, "getWorkspaces")
98-
.mockResolvedValue({ workspaces, count: workspaces.length });
99-
const updateWorkspace = jest.spyOn(API, "updateWorkspace");
100-
const user = userEvent.setup();
101-
renderWithAuth(<WorkspacesPage />);
102-
await waitForLoaderToBeRemoved();
103-
104-
for (const workspace of workspaces) {
105-
await user.click(getWorkspaceCheckbox(workspace));
106-
}
107-
108-
await user.click(screen.getByRole("button", { name: /bulk actions/i }));
109-
const updateButton = await screen.findByTestId("bulk-action-update");
110-
await user.click(updateButton);
111-
112-
// One click: no running workspaces warning, no dormant workspaces warning.
113-
// There is a running workspace and a dormant workspace selected, but they
114-
// are not outdated.
115-
const confirmButton = await screen.findByTestId("confirm-button");
116-
const dialog = await screen.findByRole("dialog");
117-
expect(dialog).toHaveTextContent(/used by/i);
118-
await user.click(confirmButton);
119-
120-
// `workspaces[0]` was up-to-date, and running
121-
// `workspaces[1]` was dormant
122-
await waitFor(() => {
123-
expect(updateWorkspace).toHaveBeenCalledTimes(2);
124-
});
125-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
126-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[3], [], false);
127-
});
128-
129-
it("warns about and updates running workspaces", async () => {
130-
const workspaces = [
131-
{ ...MockRunningOutdatedWorkspace, id: "1" },
132-
{ ...MockOutdatedWorkspace, id: "2" },
133-
{ ...MockOutdatedWorkspace, id: "3" },
134-
];
135-
jest
136-
.spyOn(API, "getWorkspaces")
137-
.mockResolvedValue({ workspaces, count: workspaces.length });
138-
const updateWorkspace = jest.spyOn(API, "updateWorkspace");
139-
const user = userEvent.setup();
140-
renderWithAuth(<WorkspacesPage />);
141-
await waitForLoaderToBeRemoved();
142-
143-
for (const workspace of workspaces) {
144-
await user.click(getWorkspaceCheckbox(workspace));
145-
}
146-
147-
await user.click(screen.getByRole("button", { name: /bulk actions/i }));
148-
const updateButton = await screen.findByTestId("bulk-action-update");
149-
await user.click(updateButton);
150-
151-
// Two clicks: 1 running workspace, no dormant workspaces warning.
152-
const confirmButton = await screen.findByTestId("confirm-button");
153-
const dialog = await screen.findByRole("dialog");
154-
expect(dialog).toHaveTextContent(/1 running workspace/i);
155-
await user.click(confirmButton);
156-
expect(dialog).toHaveTextContent(/used by/i);
157-
await user.click(confirmButton);
158-
159-
await waitFor(() => {
160-
expect(updateWorkspace).toHaveBeenCalledTimes(3);
161-
});
162-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[0], [], false);
163-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[1], [], false);
164-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
165-
});
166-
167-
it("warns about and ignores dormant workspaces", async () => {
168-
const workspaces = [
169-
{ ...MockDormantOutdatedWorkspace, id: "1" },
170-
{ ...MockOutdatedWorkspace, id: "2" },
171-
{ ...MockOutdatedWorkspace, id: "3" },
172-
];
173-
jest
174-
.spyOn(API, "getWorkspaces")
175-
.mockResolvedValue({ workspaces, count: workspaces.length });
176-
const updateWorkspace = jest.spyOn(API, "updateWorkspace");
177-
const user = userEvent.setup();
178-
renderWithAuth(<WorkspacesPage />);
179-
await waitForLoaderToBeRemoved();
180-
181-
for (const workspace of workspaces) {
182-
await user.click(getWorkspaceCheckbox(workspace));
183-
}
184-
185-
await user.click(screen.getByRole("button", { name: /bulk actions/i }));
186-
const updateButton = await screen.findByTestId("bulk-action-update");
187-
await user.click(updateButton);
188-
189-
// Two clicks: no running workspaces warning, 1 dormant workspace.
190-
const confirmButton = await screen.findByTestId("confirm-button");
191-
const dialog = await screen.findByRole("dialog");
192-
expect(dialog).toHaveTextContent(/dormant/i);
193-
await user.click(confirmButton);
194-
expect(dialog).toHaveTextContent(/used by/i);
195-
await user.click(confirmButton);
196-
197-
// `workspaces[0]` was dormant
198-
await waitFor(() => {
199-
expect(updateWorkspace).toHaveBeenCalledTimes(2);
200-
});
201-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[1], [], false);
202-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
203-
});
204-
205-
it("warns about running workspaces and then dormant workspaces", async () => {
206-
const workspaces = [
207-
{ ...MockRunningOutdatedWorkspace, id: "1" },
208-
{ ...MockDormantOutdatedWorkspace, id: "2" },
209-
{ ...MockOutdatedWorkspace, id: "3" },
210-
{ ...MockOutdatedWorkspace, id: "4" },
211-
{ ...MockWorkspace, id: "5" },
212-
];
213-
jest
214-
.spyOn(API, "getWorkspaces")
215-
.mockResolvedValue({ workspaces, count: workspaces.length });
216-
const updateWorkspace = jest.spyOn(API, "updateWorkspace");
217-
const user = userEvent.setup();
218-
renderWithAuth(<WorkspacesPage />);
219-
await waitForLoaderToBeRemoved();
220-
221-
for (const workspace of workspaces) {
222-
await user.click(getWorkspaceCheckbox(workspace));
223-
}
224-
225-
await user.click(screen.getByRole("button", { name: /bulk actions/i }));
226-
const updateButton = await screen.findByTestId("bulk-action-update");
227-
await user.click(updateButton);
228-
229-
// Three clicks: 1 running workspace, 1 dormant workspace.
230-
const confirmButton = await screen.findByTestId("confirm-button");
231-
const dialog = await screen.findByRole("dialog");
232-
expect(dialog).toHaveTextContent(/1 running workspace/i);
233-
await user.click(confirmButton);
234-
expect(dialog).toHaveTextContent(/dormant/i);
235-
await user.click(confirmButton);
236-
expect(dialog).toHaveTextContent(/used by/i);
237-
await user.click(confirmButton);
238-
239-
// `workspaces[1]` was dormant, and `workspaces[4]` was up-to-date
240-
await waitFor(() => {
241-
expect(updateWorkspace).toHaveBeenCalledTimes(3);
242-
});
243-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[0], [], false);
244-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
245-
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[3], [], false);
246-
});
247-
});
248-
24988
it("stops only the running and selected workspaces", async () => {
25089
const workspaces = [
25190
{ ...MockWorkspace, id: "1" },

0 commit comments

Comments
 (0)