
























@@ -120,7 +120,7 @@ describe("Ghost reminder bug (issue #13317)", () => {
120120MessageThreadId?: number;
121121Body?: string;
122122} => {
123-const ctx = replySpy.mock.calls[0]?.[0];
123+const ctx = replySpy.mock.calls.at(0)?.at(0);
124124if (!ctx || typeof ctx !== "object") {
125125throw new Error("expected heartbeat reply context");
126126}
@@ -140,7 +140,7 @@ describe("Ghost reminder bug (issue #13317)", () => {
140140},
141141) => {
142142expect(sendTelegram).toHaveBeenCalledTimes(1);
143-const [to, text, options] = sendTelegram.mock.calls[0] ?? [];
143+const [to, text, options] = sendTelegram.mock.calls.at(0) ?? [];
144144expect(to).toBe(params.to);
145145expect(text).toBe(params.text);
146146expect((options as { messageThreadId?: number } | undefined)?.messageThreadId).toBe(
@@ -202,7 +202,7 @@ describe("Ghost reminder bug (issue #13317)", () => {
202202telegram: sendTelegram,
203203},
204204});
205-const calledCtx = (getReplySpy.mock.calls[0]?.[0] ?? null) as {
205+const calledCtx = (getReplySpy.mock.calls.at(0)?.at(0) ?? null) as {
206206Provider?: string;
207207Body?: string;
208208SessionKey?: string;
@@ -352,8 +352,14 @@ describe("Ghost reminder bug (issue #13317)", () => {
352352expect(second.status).toBe("ran");
353353expect(getReplySpy).toHaveBeenCalledTimes(2);
354354355-const firstCtx = getReplySpy.mock.calls[0]?.[0] as { Provider?: string; Body?: string };
356-const secondCtx = getReplySpy.mock.calls[1]?.[0] as { Provider?: string; Body?: string };
355+const firstCtx = getReplySpy.mock.calls.at(0)?.at(0) as {
356+Provider?: string;
357+Body?: string;
358+};
359+const secondCtx = getReplySpy.mock.calls.at(1)?.at(0) as {
360+Provider?: string;
361+Body?: string;
362+};
357363expect(firstCtx.Provider).toBe("cron-event");
358364expect(firstCtx.Body).toContain("Cron: QMD maintenance completed");
359365expect(secondCtx.Provider).toBe("heartbeat");
@@ -600,10 +606,10 @@ describe("Ghost reminder bug (issue #13317)", () => {
600606601607expect(result.status).toBe("ran");
602608expect(getFirstReplyContext(replySpy).SessionKey).toBe(`${sessionKey}:heartbeat`);
603-expect(sendTelegram).toHaveBeenCalledTimes(1);
604-expect(sendTelegram.mock.calls[0]?.[0]).toBe("-100155462274");
605-const options = sendTelegram.mock.calls[0]?.[2] as { messageThreadId?: number } | undefined;
606-expect(options?.messageThreadId).toBeUndefined();
609+expectTelegramSend(sendTelegram, {
610+ to: "-100155462274",
611+ text: "Restart complete",
612+});
607613});
608614});
609615it("keeps output-bearing exec-event delivery pinned to the original Telegram topic when session route drifts", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。