From f2ab8ef2f271ba29cd241ef1f623ae462ca9e44c Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 11 May 2026 17:52:12 +0100 Subject: [PATCH] test: verify infra outbound payloads --- .../heartbeat-runner.response-prefix-template.test.ts | 9 ++++----- .../heartbeat-runner.returns-default-unset.test.ts | 2 +- src/infra/outbound/message.channels.test.ts | 10 +++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/infra/heartbeat-runner.response-prefix-template.test.ts b/src/infra/heartbeat-runner.response-prefix-template.test.ts index c2dadbd7536..2416bf7ef7e 100644 --- a/src/infra/heartbeat-runner.response-prefix-template.test.ts +++ b/src/infra/heartbeat-runner.response-prefix-template.test.ts @@ -93,11 +93,10 @@ describe("runHeartbeatOnce responsePrefix templates", () => { }); expect(sendTelegram).toHaveBeenCalledTimes(1); - expect(sendTelegram).toHaveBeenCalledWith( - TELEGRAM_GROUP, - "[openai-codex/gpt-5.4|think:high] Heartbeat alert", - expect.any(Object), - ); + const [target, message, options] = sendTelegram.mock.calls[0] ?? []; + expect(target).toBe(TELEGRAM_GROUP); + expect(message).toBe("[openai-codex/gpt-5.4|think:high] Heartbeat alert"); + expect(typeof options).toBe("object"); }); it("uses the resolved responsePrefix when suppressing prefixed HEARTBEAT_OK replies", async () => { diff --git a/src/infra/heartbeat-runner.returns-default-unset.test.ts b/src/infra/heartbeat-runner.returns-default-unset.test.ts index 96ef9f2feda..c61ea21a1bb 100644 --- a/src/infra/heartbeat-runner.returns-default-unset.test.ts +++ b/src/infra/heartbeat-runner.returns-default-unset.test.ts @@ -834,7 +834,7 @@ describe("runHeartbeatOnce", () => { replySpy, 0, { - Body: expect.stringMatching(/Ops check[\s\S]*Current time: /), + Body: /Ops check[\s\S]*Current time: /, SessionKey: sessionKey, From: "120363401234567890@g.us", To: "120363401234567890@g.us", diff --git a/src/infra/outbound/message.channels.test.ts b/src/infra/outbound/message.channels.test.ts index 92aaf803c1e..f2b214b386a 100644 --- a/src/infra/outbound/message.channels.test.ts +++ b/src/infra/outbound/message.channels.test.ts @@ -156,11 +156,11 @@ describe("sendMessage channel normalization", () => { }, }, assertDeps: (deps: { localchat?: ReturnType }) => { - expect(deps.localchat).toHaveBeenCalledWith( - "someone@example.com", - "hi", - expect.any(Object), - ); + expect(deps.localchat).toHaveBeenCalledTimes(1); + const [to, text, options] = deps.localchat?.mock.calls[0] ?? []; + expect(to).toBe("someone@example.com"); + expect(text).toBe("hi"); + expect(typeof options).toBe("object"); }, expectedChannel: "localchat", },