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

mergeWith.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
45
46
47
48
49
50
51
52
53
54
55
56
import { concat } from './concat.js'import { mergeWithFn } from './mergeWith.js'
test('happy', () => { const result = mergeWithFn( concat, { a : true, values : [ 10, 20 ], }, { b : true, values : [ 15, 35 ], } ) const expected = { a : true, b : true, values : [ 10, 20, 15, 35 ], } expect(result).toEqual(expected)})
// https://github.com/ramda/ramda/pull/3222/files#diff-d925d9188b478d2f1d4b26012c6dddac374f9e9d7a336604d654b9a113bfc857describe('acts as if nil values are simply empty objects', () => { it('if the first object is nil and the second empty', () => { expect(mergeWithFn( concat, undefined, {} )).toEqual({}) })
it('if the first object is empty and the second nil', () => { expect(mergeWithFn( concat, {}, null )).toEqual({}) })
it('if both objects are nil', () => { expect(mergeWithFn( concat, undefined, null )).toEqual({}) })
it('if the first object is not empty and the second is nil', () => { expect(mergeWithFn( concat, { a : 'a' }, null )).toEqual({ a : 'a' }) })
it('if the first object is nil and the second is not empty', () => { expect(mergeWithFn( concat, undefined, { a : 'a' } )).toEqual({ a : 'a' }) })})
rambda

Version Info

Tagged at
2 months ago