feat(companion): add manual heartbeat tick helper

This commit is contained in:
William Valentin
2026-02-16 18:46:48 -08:00
parent 985b7bf459
commit 873dc1ad5b
4 changed files with 30 additions and 3 deletions
+10
View File
@@ -130,4 +130,14 @@ describe('CompanionHeartbeatLoop', () => {
await vi.advanceTimersByTimeAsync(1000);
expect(publishHeartbeat).toHaveBeenCalledTimes(2);
});
it('tickNow sends heartbeat even when loop is not started', async () => {
const publishHeartbeat = vi.fn(async () => buildStatusResult());
const loop = new CompanionHeartbeatLoop({ publishHeartbeat }, { intervalMs: 1000 });
expect(loop.running).toBe(false);
await loop.tickNow();
expect(publishHeartbeat).toHaveBeenCalledTimes(1);
expect(loop.running).toBe(false);
});
});