Skip to content

Commit e29e2da

Browse files
Trottruyadorno
authored andcommitted
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: #35216 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
1 parent 2bc335d commit e29e2da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/pummel/test-timers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const WINDOW = 200; // Why does this need to be so big?
3636
assert.ok(diff > 0);
3737
console.error(`diff: ${diff}`);
3838

39-
assert.strictEqual(1000 - WINDOW < diff && diff < 1000 + WINDOW, true);
39+
assert.ok(1000 <= diff && diff < 1000 + WINDOW);
4040
}), 1000);
4141
}
4242

@@ -61,7 +61,7 @@ const WINDOW = 200; // Why does this need to be so big?
6161

6262
const t = interval_count * 1000;
6363

64-
assert.ok(t - WINDOW < diff && diff < t + WINDOW, `t: ${t}`);
64+
assert.ok(t <= diff && diff < t + (WINDOW * interval_count));
6565

6666
assert.ok(interval_count <= 3, `interval_count: ${interval_count}`);
6767
if (interval_count === 3)

0 commit comments

Comments
 (0)