-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsmartMerge.test.js
45 lines (38 loc) · 1.07 KB
/
smartMerge.test.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
'use strict';
/* global expect */
const { smartMerge } = require('../');
const merge = require('webpack-merge');
describe('smartMerge', () => {
it('array', () => {
const a = {
array: [{
a: 1,
b: 2,
abc: 'dd',
}],
cc: 'abc',
};
const b = {
array: [{
a: 1,
}],
cc: 'abc',
};
const c = {
array: [{
a: 1,
}],
cc: 'abcd',
};
const aa = { a: 1, b: { c: { d: 2 } }, z: [ '12' ] };
const bb = { a: { aa: 2 }, b: { c: { vv: 2 } }, c: { c: '33' }, z: [ '45' ] };
const result = smartMerge({}, a, b, c, aa, bb);
const result1 = smartMerge.normal({}, a, b, c, aa, bb);
const result2 = merge.smart({}, a, b, c, aa, bb);
// console.log(result);
// console.log(result1);
// console.log(result2);
expect(result1).toEqual(result2);
expect(result).not.toEqual(result2);
});
});