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

pathOr.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
44
import { pathOr } from './pathOr.js'
test('with undefined', () => { const result = pathOr( 'foo', 'x.y', { x : { y : 1 } } )
expect(result).toBe(1)})
test('with null', () => { const result = pathOr( 'foo', 'x.y', null )
expect(result).toBe('foo')})
test('with NaN', () => { const result = pathOr( 'foo', 'x.y', NaN )
expect(result).toBe('foo')})
test('curry case (x)(y)(z)', () => { const result = pathOr('foo')('x.y.z')({ x : { y : { a : 1 } } })
expect(result).toBe('foo')})
test('curry case (x)(y,z)', () => { const result = pathOr('foo', 'x.y.z')({ x : { y : { a : 1 } } })
expect(result).toBe('foo')})
test('curry case (x,y)(z)', () => { const result = pathOr('foo')('x.y.z', { x : { y : { a : 1 } } })
expect(result).toBe('foo')})
rambda

Version Info

Tagged at
2 months ago