From c3b9f8cf191f3f69aed13845bf840071772e162d Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 11 May 2026 19:00:53 +0100 Subject: [PATCH] test: guard server cron mock args --- src/gateway/server-cron.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gateway/server-cron.test.ts b/src/gateway/server-cron.test.ts index a32862be306a..841b8e3648f1 100644 --- a/src/gateway/server-cron.test.ts +++ b/src/gateway/server-cron.test.ts @@ -126,8 +126,13 @@ function callArg( label: string, ) { const call = mock.mock.calls.at(callIndex); - expect(call, label).toBeDefined(); - return call?.[argIndex]; + if (!call) { + throw new Error(`Expected mock call: ${label}`); + } + if (argIndex >= call.length) { + throw new Error(`Expected mock call argument ${argIndex}: ${label}`); + } + return call[argIndex]; } function expectHookContext(callIndex: number, fields: { config?: unknown; hasGetCron?: boolean }) {