mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
test(std): unit test for async/delay (#7671)
This commit is contained in:
parent
83f53c6455
commit
826e899bbc
1 changed files with 14 additions and 0 deletions
14
std/async/delay_test.ts
Normal file
14
std/async/delay_test.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { delay } from "./delay.ts";
|
||||
import { assert } from "../testing/asserts.ts";
|
||||
|
||||
Deno.test("[async] delay", async function (): Promise<void> {
|
||||
const start = new Date();
|
||||
const delayedPromise = delay(100);
|
||||
const result = await delayedPromise;
|
||||
const diff = new Date().getTime() - start.getTime();
|
||||
assert(result === undefined);
|
||||
assert(diff >= 100);
|
||||
});
|
||||
|
||||
export {};
|
Loading…
Reference in a new issue