feat(companion): add manual heartbeat tick helper
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user