CEC-0000: allow test to be off by 1ms (#499)
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user