Skip to content

Commit 8d7fe73

Browse files
committed
fix: update old tests to be correctly parameterized
1 parent 2c55fd8 commit 8d7fe73

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

site/src/pages/WorkspacePage/WorkspacePage.test.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,12 @@ describe("WorkspacePage", () => {
178178
},
179179
),
180180
);
181+
181182
const startWorkspaceMock = jest
182183
.spyOn(api, "startWorkspace")
183184
.mockImplementation(() => Promise.resolve(MockWorkspaceBuild));
184-
await testButton(MockWorkspace, "Start", startWorkspaceMock);
185+
186+
await testButton(MockStoppedWorkspace, "Start", startWorkspaceMock);
185187
});
186188

187189
it("requests a stop job when the user presses Stop", async () => {
@@ -221,20 +223,12 @@ describe("WorkspacePage", () => {
221223
},
222224
),
223225
);
226+
224227
const cancelWorkspaceMock = jest
225228
.spyOn(api, "cancelWorkspaceBuild")
226229
.mockImplementation(() => Promise.resolve({ message: "job canceled" }));
227230

228-
await renderWorkspacePage(MockWorkspace);
229-
230-
const workspaceActions = screen.getByTestId("workspace-actions");
231-
const cancelButton = within(workspaceActions).getByRole("button", {
232-
name: "Cancel",
233-
});
234-
235-
await userEvent.click(cancelButton);
236-
237-
expect(cancelWorkspaceMock).toBeCalled();
231+
await testButton(MockStartingWorkspace, "Cancel", cancelWorkspaceMock);
238232
});
239233

240234
it("requests an update when the user presses Update", async () => {

0 commit comments

Comments
 (0)