Fix obscure config merge bug.
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
isTruthy,
|
||||
isValidDate,
|
||||
prettifyTitle,
|
||||
recursivelyMergeObjectsNotArrays,
|
||||
runWhenIdleIfSupported,
|
||||
setOrRemoveAttribute,
|
||||
setify,
|
||||
@@ -291,3 +292,49 @@ describe('getChildrenFromElement', () => {
|
||||
expect(getChildrenFromElement(slot)).toEqual(children);
|
||||
});
|
||||
});
|
||||
|
||||
describe('recursivelyMergeObjectsNotArrays', () => {
|
||||
it('should recursively merge objects but replace arrays', () => {
|
||||
expect(
|
||||
recursivelyMergeObjectsNotArrays(
|
||||
{
|
||||
a: {
|
||||
b: {
|
||||
c: 3,
|
||||
d: {
|
||||
e: 4,
|
||||
},
|
||||
array: [1, 2, 3],
|
||||
},
|
||||
other: {
|
||||
field: 7,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
a: {
|
||||
b: {
|
||||
array: [4],
|
||||
d: {
|
||||
e: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
).toEqual({
|
||||
a: {
|
||||
b: {
|
||||
c: 3,
|
||||
array: [4],
|
||||
d: {
|
||||
e: 5,
|
||||
},
|
||||
},
|
||||
other: {
|
||||
field: 7,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user