Skip to content

Commit 19530c6

Browse files
authored
fix: update DeleteWorkspaceOptions to pick properties correctly (coder#13423)
* fix: update typo * fix: update typo in call site * fix: update type for deleteWorkspace mock * fix: update one more type mismatch
1 parent 4758952 commit 19530c6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

site/src/api/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ type RestartWorkspaceParameters = Readonly<{
314314

315315
export type DeleteWorkspaceOptions = Pick<
316316
TypesGen.CreateWorkspaceBuildRequest,
317-
"log_level" & "orphan"
317+
"log_level" | "orphan"
318318
>;
319319

320320
export type DeploymentConfig = Readonly<{

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ describe("WorkspacePage", () => {
161161
});
162162
await user.click(confirmButton);
163163
// arguments are workspace.name, log level (undefined), and orphan
164-
expect(deleteWorkspaceMock).toBeCalledWith(MockFailedWorkspace.id, {
164+
expect(deleteWorkspaceMock).toBeCalledWith<
165+
[string, apiModule.DeleteWorkspaceOptions]
166+
>(MockFailedWorkspace.id, {
165167
log_level: undefined,
166168
orphan: true,
167169
});
@@ -425,8 +427,10 @@ describe("WorkspacePage", () => {
425427

426428
test("Retry with debug logs", async () => {
427429
await testButton(failedDelete, retryDebugButtonRe, mockDelete);
428-
expect(mockDelete).toBeCalledWith(failedDelete.id, {
429-
logLevel: "debug",
430+
expect(mockDelete).toBeCalledWith<
431+
[string, apiModule.DeleteWorkspaceOptions]
432+
>(failedDelete.id, {
433+
log_level: "debug",
430434
});
431435
});
432436
});

site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export const WorkspaceReadyPage: FC<WorkspaceReadyPageProps> = ({
173173
stopWorkspaceMutation.mutate({ logLevel });
174174
break;
175175
case "delete":
176-
deleteWorkspaceMutation.mutate({ logLevel });
176+
deleteWorkspaceMutation.mutate({ log_level: logLevel });
177177
break;
178178
}
179179
};

0 commit comments

Comments
 (0)