fix: update DeleteWorkspaceOptions to pick properties correctly (#13423)

* fix: update typo

* fix: update typo in call site

* fix: update type for deleteWorkspace mock

* fix: update one more type mismatch
This commit is contained in:
Michael Smith
2024-05-31 10:23:59 -04:00
committed by GitHub
parent 4758952ebc
commit 19530c6b44
3 changed files with 9 additions and 5 deletions

View File

@ -314,7 +314,7 @@ type RestartWorkspaceParameters = Readonly<{
export type DeleteWorkspaceOptions = Pick< export type DeleteWorkspaceOptions = Pick<
TypesGen.CreateWorkspaceBuildRequest, TypesGen.CreateWorkspaceBuildRequest,
"log_level" & "orphan" "log_level" | "orphan"
>; >;
export type DeploymentConfig = Readonly<{ export type DeploymentConfig = Readonly<{

View File

@ -161,7 +161,9 @@ describe("WorkspacePage", () => {
}); });
await user.click(confirmButton); await user.click(confirmButton);
// arguments are workspace.name, log level (undefined), and orphan // arguments are workspace.name, log level (undefined), and orphan
expect(deleteWorkspaceMock).toBeCalledWith(MockFailedWorkspace.id, { expect(deleteWorkspaceMock).toBeCalledWith<
[string, apiModule.DeleteWorkspaceOptions]
>(MockFailedWorkspace.id, {
log_level: undefined, log_level: undefined,
orphan: true, orphan: true,
}); });
@ -425,8 +427,10 @@ describe("WorkspacePage", () => {
test("Retry with debug logs", async () => { test("Retry with debug logs", async () => {
await testButton(failedDelete, retryDebugButtonRe, mockDelete); await testButton(failedDelete, retryDebugButtonRe, mockDelete);
expect(mockDelete).toBeCalledWith(failedDelete.id, { expect(mockDelete).toBeCalledWith<
logLevel: "debug", [string, apiModule.DeleteWorkspaceOptions]
>(failedDelete.id, {
log_level: "debug",
}); });
}); });
}); });

View File

@ -173,7 +173,7 @@ export const WorkspaceReadyPage: FC<WorkspaceReadyPageProps> = ({
stopWorkspaceMutation.mutate({ logLevel }); stopWorkspaceMutation.mutate({ logLevel });
break; break;
case "delete": case "delete":
deleteWorkspaceMutation.mutate({ logLevel }); deleteWorkspaceMutation.mutate({ log_level: logLevel });
break; break;
} }
}; };