mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
test: improve assertions in pummel/test-timers
* Timers should not fire early. Check for that. * Allow the wiggle-room to increase on subsequent iterations of intervals. PR-URL: https://github.com/nodejs/node/pull/35216 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
parent
1018e520d6
commit
5a6bdd040d
|
|
@ -36,7 +36,7 @@ const WINDOW = 200; // Why does this need to be so big?
|
|||
assert.ok(diff > 0);
|
||||
console.error(`diff: ${diff}`);
|
||||
|
||||
assert.strictEqual(1000 - WINDOW < diff && diff < 1000 + WINDOW, true);
|
||||
assert.ok(1000 <= diff && diff < 1000 + WINDOW);
|
||||
}), 1000);
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ const WINDOW = 200; // Why does this need to be so big?
|
|||
|
||||
const t = interval_count * 1000;
|
||||
|
||||
assert.ok(t - WINDOW < diff && diff < t + WINDOW, `t: ${t}`);
|
||||
assert.ok(t <= diff && diff < t + (WINDOW * interval_count));
|
||||
|
||||
assert.ok(interval_count <= 3, `interval_count: ${interval_count}`);
|
||||
if (interval_count === 3)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user