test (heartbeat): relax brittle reply option assertions

This commit is contained in:
Vignesh Natarajan
2026-02-16 11:57:29 -08:00
parent 3646625dc1
commit 1f99d82712
2 changed files with 20 additions and 12 deletions

View File

@@ -112,10 +112,12 @@ describe("runHeartbeatOnce heartbeat model override", () => {
it("passes heartbeatModelOverride from defaults heartbeat config", async () => {
const replyOpts = await runDefaultsHeartbeat({ model: "ollama/llama3.2:1b" });
expect(replyOpts).toEqual({
isHeartbeat: true,
heartbeatModelOverride: "ollama/llama3.2:1b",
});
expect(replyOpts).toEqual(
expect.objectContaining({
isHeartbeat: true,
heartbeatModelOverride: "ollama/llama3.2:1b",
}),
);
});
it("passes per-agent heartbeat model override (merged with defaults)", async () => {
@@ -171,14 +173,20 @@ describe("runHeartbeatOnce heartbeat model override", () => {
it("does not pass heartbeatModelOverride when no heartbeat model is configured", async () => {
const replyOpts = await runDefaultsHeartbeat({ model: undefined });
expect(replyOpts).toStrictEqual({ isHeartbeat: true });
expect(replyOpts).toEqual(
expect.objectContaining({
isHeartbeat: true,
}),
);
});
it("trims heartbeat model override before passing it downstream", async () => {
const replyOpts = await runDefaultsHeartbeat({ model: " ollama/llama3.2:1b " });
expect(replyOpts).toEqual({
isHeartbeat: true,
heartbeatModelOverride: "ollama/llama3.2:1b",
});
expect(replyOpts).toEqual(
expect.objectContaining({
isHeartbeat: true,
heartbeatModelOverride: "ollama/llama3.2:1b",
}),
);
});
});

View File

@@ -545,7 +545,7 @@ describe("runHeartbeatOnce", () => {
Body: expect.stringMatching(/Ops check[\s\S]*Current time: /),
SessionKey: sessionKey,
}),
{ isHeartbeat: true },
expect.objectContaining({ isHeartbeat: true }),
cfg,
);
} finally {
@@ -622,7 +622,7 @@ describe("runHeartbeatOnce", () => {
expect(sendWhatsApp).toHaveBeenCalledWith("+1555", "Final alert", expect.any(Object));
expect(replySpy).toHaveBeenCalledWith(
expect.objectContaining({ SessionKey: sessionKey }),
{ isHeartbeat: true },
expect.objectContaining({ isHeartbeat: true }),
cfg,
);
} finally {
@@ -700,7 +700,7 @@ describe("runHeartbeatOnce", () => {
expect(sendWhatsApp).toHaveBeenCalledWith(groupId, "Group alert", expect.any(Object));
expect(replySpy).toHaveBeenCalledWith(
expect.objectContaining({ SessionKey: groupSessionKey }),
{ isHeartbeat: true },
expect.objectContaining({ isHeartbeat: true }),
cfg,
);
} finally {