1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

test(std): unit test for async/delay (#7671)

This commit is contained in:
Csaba Okrona 2020-09-25 14:57:31 +02:00 committed by GitHub
parent 83f53c6455
commit 826e899bbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

14
std/async/delay_test.ts Normal file
View file

@ -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 {};