test: guard backup registration mock call

This commit is contained in:
Peter Steinberger
2026-05-12 04:29:58 +01:00
parent bf71a896d8
commit dc3654b544

View File

@@ -43,10 +43,11 @@ describe("registerBackupCommand", () => {
function expectForwardedOptions(command: typeof backupCreateCommand): Record<string, unknown> {
expect(command).toHaveBeenCalledTimes(1);
const [runtimeArg, options] = command.mock.calls[0] as unknown as [
typeof runtime,
Record<string, unknown>,
];
const call = command.mock.calls.at(0);
if (!call) {
throw new Error("expected backup command call");
}
const [runtimeArg, options] = call as unknown as [typeof runtime, Record<string, unknown>];
expect(runtimeArg).toBe(runtime);
return options;
}