1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

timers: align unit tests with others

This commit is contained in:
Li Hao 2018-10-08 14:58:44 +08:00 committed by Ryan Dahl
parent 900dd6fa42
commit 951e5def98

View file

@ -32,25 +32,21 @@ test(async function timeoutSuccess() {
});
test(async function timeoutArgs() {
const { promise, resolve } = deferred();
const arg = 1;
await new Promise((resolve, reject) => {
setTimeout(
(a, b, c) => {
try {
assertEqual(a, arg);
assertEqual(b, arg.toString());
assertEqual(c, [arg]);
resolve();
} catch (e) {
reject(e);
}
},
10,
arg,
arg.toString(),
[arg]
);
});
await promise;
});
test(async function timeoutCancelSuccess() {
@ -151,16 +147,8 @@ test(async function intervalOrdering() {
clearTimeout(timers[i]);
}
}
await new Promise((resolve, reject) => {
setTimeout(() => {
try {
await waitForMs(100);
assertEqual(timeouts, 1);
resolve();
} catch (e) {
reject(e);
}
}, 100);
});
});
test(async function intervalCancelInvalidSilentFail() {