-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
27 lines (23 loc) 路 855 Bytes
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// I buy and sell https://FreedomCash.org
import { fail } from "https://deno.land/std@0.210.0/testing/asserts.ts"
import { sleep, sleepRandomAmountOfSeconds } from "https://deno.land/x/sleep/mod.ts"
Deno.test("sleep for 2 seconds", async (): Promise<void> => {
const sleepStartAt = Date.now()
await sleep(2)
const sleepEndAt = Date.now()
const sleepDuration = sleepEndAt - sleepStartAt
if (sleepDuration < 2000 || sleepDuration > 2100) {
fail("you should somehow relax")
}
})
Deno.test("sleep for random amount of seconds between 2 and 4 seconds", async (): Promise<
void
> => {
const sleepStartAt = Date.now()
await sleepRandomAmountOfSeconds(2, 4)
const sleepEndAt = Date.now()
const sleepDuration = sleepEndAt - sleepStartAt
if (sleepDuration < 2000 || sleepDuration > 4100) {
fail("you should somehow relax")
}
})