

























@@ -51,6 +51,14 @@ describe("runHeartbeatOnce responsePrefix templates", () => {
5151});
5252}
535354+function requireFirstMockCall<T>(mock: { mock: { calls: T[][] } }, label: string): T[] {
55+const call = mock.mock.calls.at(0);
56+if (!call) {
57+throw new Error(`expected ${label} call`);
58+}
59+return call;
60+}
61+5462async function runTemplatedHeartbeat(params: { responsePrefix: string; replyText: string }) {
5563return withTempTelegramHeartbeatSandbox(async ({ tmpDir, storePath, replySpy }) => {
5664const cfg = createTelegramHeartbeatConfig({
@@ -93,7 +101,7 @@ describe("runHeartbeatOnce responsePrefix templates", () => {
93101});
9410295103expect(sendTelegram).toHaveBeenCalledTimes(1);
96-const [target, message, options] = sendTelegram.mock.calls[0] ?? [];
104+const [target, message, options] = requireFirstMockCall(sendTelegram, "telegram send");
97105expect(target).toBe(TELEGRAM_GROUP);
98106expect(message).toBe("[openai-codex/gpt-5.4|think:high] Heartbeat alert");
99107expect(typeof options).toBe("object");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。