fix: re-enable skipped Heart tests and make non-asserting checks assert (#7845)

This commit is contained in:
YONGJAE LEE (이용재)
2026-06-17 02:58:42 +09:00
committed by GitHub
parent 72086edbdb
commit 7dfd68589a
7 changed files with 28 additions and 24 deletions

View File

@@ -115,6 +115,9 @@ describe("heartbeatTimer", () => {
const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
await heart.beat()
jest.advanceTimersByTime(60 * 1000)
// Yield a real macrotask so the callback's rejection handler can run first
// (fake timers stub the global setImmediate).
await new Promise((resolve) => jest.requireActual("timers").setImmediate(resolve))
expect(mockIsActive).toHaveBeenCalled()
expect(logger.warn).toHaveBeenCalledWith(errorMsg)
@@ -147,7 +150,7 @@ describe("stateChange", () => {
expect(mockOnChange.mock.calls[0][0]).toBe("alive")
})
it.only("should change to expired when not active", async () => {
it("should change to expired when not active", async () => {
jest.useFakeTimers()
heart = new Heart(`${testDir}/shutdown.txt`, () => new Promise((resolve) => resolve(false)))
const mockOnChange = jest.fn()