use TKUnit wait

This commit is contained in:
Eduardo Speroni
2020-11-16 14:01:32 -03:00
parent ae455ed977
commit 998c97c1f4

View File

@ -174,20 +174,12 @@ export function test_setInterval_callbackCalledWithExtraArgs(done) {
export function test_setInterval_callbackNotDelayedByBusyWork() { export function test_setInterval_callbackNotDelayedByBusyWork() {
let calls = 0; let calls = 0;
function busyWait(ms: number) {
const waitStart = Date.now();
while (true) {
if (Date.now() - waitStart >= ms) {
break;
}
}
}
let firstCall = true; let firstCall = true;
const id = timer.setInterval(() => { const id = timer.setInterval(() => {
calls++; calls++;
if (firstCall) { if (firstCall) {
firstCall = false; firstCall = false;
busyWait(25); TKUnit.wait(0.025);
} }
}, 50); }, 50);