test: verify infra outbound payloads

This commit is contained in:
Shakker
2026-05-11 17:52:12 +01:00
parent d092bf0b17
commit f2ab8ef2f2
3 changed files with 10 additions and 11 deletions

View File

@@ -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 () => {

View File

@@ -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",

View File

@@ -156,11 +156,11 @@ describe("sendMessage channel normalization", () => {
},
},
assertDeps: (deps: { localchat?: ReturnType<typeof vi.fn> }) => {
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",
},