diff --git a/async/delay_test.ts b/async/delay_test.ts new file mode 100644 index 000000000..2e4a56a84 --- /dev/null +++ b/async/delay_test.ts @@ -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 { + 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 {};