mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
test: unit test for async/delay (denoland/deno#7671)
This commit is contained in:
parent
689f972192
commit
435095d188
14
async/delay_test.ts
Normal file
14
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 New Issue
Block a user