Skip to content

Commit 6627b0b

Browse files
committed
feat(heart): add test to ensure no warnings called
1 parent bd3890a commit 6627b0b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

test/unit/node/heart.test.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,12 @@ describe("Heart", () => {
6868
const isAlive = heart.alive()
6969
expect(isAlive).toBe(false)
7070
})
71-
it("should beat twice and maintain reference to Heart", async () => {
71+
it("should beat twice without warnings", async () => {
7272
// Use fake timers so we can speed up setTimeout
7373
jest.useFakeTimers()
7474
heart = new Heart(`${testDir}/hello.txt`, mockIsActive(true))
75-
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
75+
await heart.beat()
76+
// Speed up clocks so this.heartbeatTimer is called after .beat()
7977
jest.runAllTimers()
8078
expect(logger.warn).not.toHaveBeenCalled()
8179
})

0 commit comments

Comments
 (0)