


























@@ -193,10 +193,10 @@ const defaultRegistry = createTestRegistry([
193193]);
194194195195function getFirstDeliveryText(deliver: ReturnType<typeof vi.fn>): string {
196-const firstCall = deliver.mock.calls[0]?.[0] as
197-| { payloads?: Array<{ text?: string }> }
198- | undefined;
199-return firstCall?.payloads?.[0]?.text ?? "";
196+const firstCall = requireFirstCallArg(deliver, "delivery params") as {
197+payloads?: Array<{ text?: string }>;
198+};
199+return firstCall.payloads?.[0]?.text ?? "";
200200}
201201202202function requireRecord(value: unknown, label: string): Record<string, unknown> {
@@ -210,7 +210,11 @@ function requireFirstCallArg(
210210mock: ReturnType<typeof vi.fn>,
211211label: string,
212212): Record<string, unknown> {
213-return requireRecord(mock.mock.calls[0]?.[0], label);
213+const firstCall = mock.mock.calls.at(0);
214+if (!firstCall) {
215+throw new Error(`expected ${label} call`);
216+}
217+return requireRecord(firstCall.at(0), label);
214218}
215219216220function requireFirstPayload(deliver: ReturnType<typeof vi.fn>): ReplyPayload {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。