deno.land / x / rambda@v9.1.1 / source / on.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
import { on } from './on.js'
const binaryFn = (a, b) => a === bconst unaryFn = x => x.aconst a = { b : 0, a : 1,}const b = { a : 1 }
test('happy', () => { expect(on( binaryFn, unaryFn, a, b )).toBeTrue()})
test('return type is not limited to boolean', () => { expect(on( binaryFn, unaryFn, a, b )).toBeTrue()})
test('curried - last input', () => { expect(on( binaryFn, unaryFn, a )(b)).toBeTrue()})
test('curried - last two inputs', () => { expect(on(binaryFn, unaryFn)(a, b)).toBeTrue()})
test('not supported curried case', () => { expect(() => on(binaryFn, unaryFn)(a)(b)).toThrowErrorMatchingInlineSnapshot('"Cannot read properties of undefined (reading \'a\')"')})
rambda

Version Info

Tagged at
2 months ago