summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/timers_test.ts16
1 files changed, 5 insertions, 11 deletions
diff --git a/js/timers_test.ts b/js/timers_test.ts
index b43817437..51dfbd7e0 100644
--- a/js/timers_test.ts
+++ b/js/timers_test.ts
@@ -58,10 +58,9 @@ test(async function timeoutCancelSuccess() {
let count = 0;
const id = setTimeout(() => {
count++;
- }, 500);
+ }, 1);
// Cancelled, count should not increment
clearTimeout(id);
- // Wait a bit longer than 500ms
await waitForMs(600);
assertEquals(count, 0);
});
@@ -113,19 +112,14 @@ test(async function intervalSuccess() {
let count = 0;
const id = setInterval(() => {
count++;
- if (count === 2) {
- // TODO: clearInterval(id) here alone seems not working
- // causing unit_tests.ts to block forever
- // Requires further investigation...
- clearInterval(id);
- resolve();
- }
- }, 200);
+ clearInterval(id);
+ resolve();
+ }, 100);
await promise;
// Clear interval
clearInterval(id);
// count should increment twice
- assertEquals(count, 2);
+ assertEquals(count, 1);
});
test(async function intervalCancelSuccess() {