summaryrefslogtreecommitdiff
path: root/std/async/delay_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/async/delay_test.ts')
-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 {};