diff options
author | Csaba Okrona <ochronus@ochronus.com> | 2020-09-25 14:57:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-25 14:57:31 +0200 |
commit | 826e899bbcdcadfd549fb5ed776100f4f4d400d2 (patch) | |
tree | 28f0b245ef3e2e9dab44bdb6b4524da06117c1dc /std/async | |
parent | 83f53c6455bacbe62998ebc56199d0c2d7f1a870 (diff) |
test(std): unit test for async/delay (#7671)
Diffstat (limited to 'std/async')
-rw-r--r-- | std/async/delay_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/std/async/delay_test.ts b/std/async/delay_test.ts new file mode 100644 index 000000000..2e4a56a84 --- /dev/null +++ b/std/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<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 {}; |