deno.land / x / rambda@v9.1.1 / source / waitFor-spec.ts

waitFor-spec.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {delay, waitFor} from 'rambda'
describe('R.waitFor', () => { it('async condition with input', async() => { let counter = 0 const condition = async(x: number) => { await delay(10) counter += x return counter > 2 } const result = await waitFor(condition, 1000, 6)(6)
result // $ExpectType boolean }) it('async condition without input', async() => { let counter = 0 const condition = async() => { await delay(10) counter++ return counter > 2 } const result = await waitFor(condition, 1000, 6)()
result // $ExpectType boolean }) it('sync condition with input', async() => { let counter = 0 const condition = (x: number) => { counter += x return counter > 2 } const result = await waitFor(condition, 1000, 6)(6)
result // $ExpectType boolean }) it('sync condition without input', async() => { let counter = 0 const condition = () => { counter++ return counter > 2 } const result = await waitFor(condition, 1000, 6)()
result // $ExpectType boolean })})
rambda

Version Info

Tagged at
2 months ago