summaryrefslogtreecommitdiff
path: root/std/async
diff options
context:
space:
mode:
authorCsaba Okrona <ochronus@ochronus.com>2020-09-25 14:57:31 +0200
committerGitHub <noreply@github.com>2020-09-25 14:57:31 +0200
commit826e899bbcdcadfd549fb5ed776100f4f4d400d2 (patch)
tree28f0b245ef3e2e9dab44bdb6b4524da06117c1dc /std/async
parent83f53c6455bacbe62998ebc56199d0c2d7f1a870 (diff)
test(std): unit test for async/delay (#7671)
Diffstat (limited to 'std/async')
-rw-r--r--std/async/delay_test.ts14
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 {};