mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
[Unit Test] utils: delay
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import "./local/snowflake.ts";
|
||||
import "./util/validateLength.ts";
|
||||
import "./util/hasProperty.ts";
|
||||
import "./util/validate_length.ts";
|
||||
import "./util/utils.ts";
|
||||
import "./util/hash.ts";
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { hasProperty } from "../../src/util/utils.ts";
|
||||
import { hasProperty, delay } from "../../src/util/utils.ts";
|
||||
import { assertEquals } from "../deps.ts";
|
||||
|
||||
// hasProperty
|
||||
|
||||
const obj = { prop: "lts372005" };
|
||||
Deno.test({
|
||||
name: "[utils] hasProperty does HAVE property",
|
||||
@@ -13,3 +16,15 @@ Deno.test({
|
||||
assertEquals(hasProperty(obj, "lts372005"), false);
|
||||
},
|
||||
});
|
||||
|
||||
// delay
|
||||
|
||||
Deno.test({
|
||||
name: "[utils] delay 2000 ms",
|
||||
async fn() {
|
||||
const before = Date.now();
|
||||
await delay(2000);
|
||||
const after = Date.now();
|
||||
if (after - before < 2000) throw new Error(`delay(2000) delayed ${after - before}ms`);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user