We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e93db5 commit 2db3cc1Copy full SHA for 2db3cc1
test/unit/node/heart.test.ts
@@ -75,6 +75,17 @@ describe("Heart", () => {
75
const isAlive = heart.alive()
76
expect(isAlive).toBe(false)
77
})
78
+ it("should beat twice and maintain reference to Heart", async () => {
79
+ // Use fake timers so we can speed up setTimeout
80
+ jest.useFakeTimers()
81
+ heart = new Heart(`${testDir}/hello.txt`, mockIsActive(true))
82
+ heart.beat()
83
+ // we need to speed up clocks, timeouts
84
+ // call heartbeat again (and it won't be alive I think)
85
+ // then assert no warnings were called
86
+ jest.runAllTimers()
87
+ expect(logger.warn).not.toHaveBeenCalled()
88
+ })
89
90
91
describe("heartbeatTimer", () => {
0 commit comments