mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
timers: align unit tests with others
This commit is contained in:
parent
900dd6fa42
commit
951e5def98
1 changed files with 16 additions and 28 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue