1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
denoland-deno/std/async/delay_test.ts
2021-01-10 21:59:07 -05:00

12 lines
440 B
TypeScript

// Copyright 2018-2021 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);
});