deno.land / x / rambda@v9.1.1 / source / both.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
37
38
39
40
41
42
43
import { both } from './both.js'
const firstFn = val => val > 0const secondFn = val => val < 10
test('with curry', () => { expect(both(firstFn)(secondFn)(17)).toBeFalse()})
test('without curry', () => { expect(both(firstFn, secondFn)(7)).toBeTrue()})
test('with multiple inputs', () => { const between = function ( a, b, c ){ return a < b && b < c } const total20 = function ( a, b, c ){ return a + b + c === 20 } const fn = both(between, total20) expect(fn( 5, 7, 8 )).toBeTrue()})
test('skip evaluation of the second expression', () => { let effect = 'not evaluated' const F = function (){ return false } const Z = function (){ effect = 'Z got evaluated' } both(F, Z)()
expect(effect).toBe('not evaluated')})
rambda

Version Info

Tagged at
2 months ago