deno.land / x / rambda@v9.1.1 / source / filterAsync.spec.js

filterAsync.spec.js
نووسراو ببینە
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
import { delay } from './delay.js'import { filterAsync } from './filterAsync.js'
test('happy', async () => { const predicate = async (x, i) => { expect(i).toBeNumber() await delay(100)
return x % 2 === 1 } const result = await filterAsync(predicate)([ 1, 2, 3 ]) expect(result).toEqual([ 1, 3 ])})
test('with object', async () => { const predicate = async (x, prop) => { expect(prop).toBeString() await delay(100)
return x % 2 === 1 } const result = await filterAsync(predicate, { a : 1, b : 2, c : 3, d : 4, e : 5, })
expect(result).toEqual({ a : 1, c : 3, e : 5, })})
rambda

Version Info

Tagged at
2 months ago