We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79ce2b5 commit 4d29cd5Copy full SHA for 4d29cd5
test/unit/node/heart.test.ts
@@ -68,7 +68,17 @@ describe("Heart", () => {
68
const isAlive = heart.alive()
69
expect(isAlive).toBe(false)
70
})
71
- it.todo("should beat twice without warnings")
+ it("should beat twice without warnings", async () => {
72
+ // Use fake timers so we can speed up setTimeout
73
+ jest.useFakeTimers()
74
+ heart = new Heart(`${testDir}/hello.txt`, mockIsActive(true))
75
+ await heart.beat()
76
+ // we need to speed up clocks, timeouts
77
+ // call heartbeat again (and it won't be alive I think)
78
+ // then assert no warnings were called
79
+ jest.runAllTimers()
80
+ expect(logger.warn).not.toHaveBeenCalled()
81
+ })
82
83
84
describe("heartbeatTimer", () => {
0 commit comments