CEC-0000: allow test to be off by 1ms (#499)

This commit is contained in:
Tristan Timblin
2024-01-29 08:53:11 -08:00
committed by GitHub
parent cb96d2d5e3
commit 803d964a7e

View File

@@ -14,7 +14,7 @@ describe("Polling", () => {
const poll = new Polling(callback, 100); const poll = new Polling(callback, 100);
const spy = jest.spyOn(poll, "callback"); const spy = jest.spyOn(poll, "callback");
poll.start(); poll.start();
await sleep(500); await sleep(501); // +1 for safety
poll.end(); poll.end();
await sleep(500); await sleep(500);
expect(spy).toHaveBeenCalledTimes(5); expect(spy).toHaveBeenCalledTimes(5);
@@ -25,7 +25,7 @@ describe("Polling", () => {
const poll = new Polling(callback, 100); const poll = new Polling(callback, 100);
const spy = jest.spyOn(poll, "callback"); const spy = jest.spyOn(poll, "callback");
poll.start(); poll.start();
await sleep(1000); await sleep(1001); // +1 for safety
expect(spy).toHaveBeenCalledTimes(5); expect(spy).toHaveBeenCalledTimes(5);
}); });
}); });