From 3fb4a7eb531e89779fa5fc99c635e2a9ca3a8793 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Feb 2026 09:44:16 +0000 Subject: [PATCH] test: remove duplicate hook-wake heartbeat empty-file case --- ...tbeat-runner.returns-default-unset.test.ts | 67 ------------------- 1 file changed, 67 deletions(-) diff --git a/src/infra/heartbeat-runner.returns-default-unset.test.ts b/src/infra/heartbeat-runner.returns-default-unset.test.ts index a7fc891b7..f8a76d952 100644 --- a/src/infra/heartbeat-runner.returns-default-unset.test.ts +++ b/src/infra/heartbeat-runner.returns-default-unset.test.ts @@ -1093,73 +1093,6 @@ describe("runHeartbeatOnce", () => { } }); - it("does not skip hook-triggered heartbeat when HEARTBEAT.md is effectively empty", async () => { - const tmpDir = await createCaseDir("openclaw-hb"); - const storePath = path.join(tmpDir, "sessions.json"); - const workspaceDir = path.join(tmpDir, "workspace"); - const replySpy = vi.spyOn(replyModule, "getReplyFromConfig"); - try { - await fs.mkdir(workspaceDir, { recursive: true }); - await fs.writeFile( - path.join(workspaceDir, "HEARTBEAT.md"), - "# HEARTBEAT.md\n\n## Tasks\n\n", - "utf-8", - ); - - const cfg: OpenClawConfig = { - agents: { - defaults: { - workspace: workspaceDir, - heartbeat: { every: "5m", target: "whatsapp" }, - }, - }, - channels: { whatsapp: { allowFrom: ["*"] } }, - session: { store: storePath }, - }; - const sessionKey = resolveMainSessionKey(cfg); - - await fs.writeFile( - storePath, - JSON.stringify( - { - [sessionKey]: { - sessionId: "sid", - updatedAt: Date.now(), - lastChannel: "whatsapp", - lastTo: "+1555", - }, - }, - null, - 2, - ), - ); - - replySpy.mockResolvedValue({ text: "hook event processed" }); - const sendWhatsApp = vi.fn().mockResolvedValue({ - messageId: "m1", - toJid: "jid", - }); - - const res = await runHeartbeatOnce({ - cfg, - reason: "hook:wake", - deps: { - sendWhatsApp, - getQueueSize: () => 0, - nowMs: () => 0, - webAuthExists: async () => true, - hasActiveWebListener: () => true, - }, - }); - - expect(res.status).toBe("ran"); - expect(replySpy).toHaveBeenCalled(); - expect(sendWhatsApp).toHaveBeenCalledTimes(1); - } finally { - replySpy.mockRestore(); - } - }); - it("runs heartbeat when HEARTBEAT.md has actionable content", async () => { const tmpDir = await createCaseDir("openclaw-hb"); const storePath = path.join(tmpDir, "sessions.json");