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

mergeAll.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 { mergeAll } from './mergeAll.js'
test('case 1', () => { const arr = [ { a : 1 }, { b : 2 }, { c : 3 } ] const expectedResult = { a : 1, b : 2, c : 3, } expect(mergeAll(arr)).toEqual(expectedResult)})
test('case 2', () => { expect(mergeAll([ { foo : 1 }, { bar : 2 }, { baz : 3 } ])).toEqual({ foo : 1, bar : 2, baz : 3, })})
describe('acts as if nil values are simply empty objects', () => { it('if the first object is nil', () => { expect(mergeAll([ null, { foo : 1 }, { foo : 2 }, { bar : 2 } ])).toEqual({ foo : 2, bar : 2, }) })
it('if the last object is nil', () => { expect(mergeAll([ { foo : 1 }, { foo : 2 }, { bar : 2 }, undefined ])).toEqual({ foo : 2, bar : 2, }) })
it('if an intermediate object is nil', () => { expect(mergeAll([ { foo : 1 }, { foo : 2 }, null, { bar : 2 } ])).toEqual({ foo : 2, bar : 2, }) })})
rambda

Version Info

Tagged at
2 months ago