From bbd536fc04a312ffa003e455af237742d18adb49 Mon Sep 17 00:00:00 2001 From: Danny Fallon Date: Fri, 26 Feb 2016 14:14:32 +0000 Subject: [PATCH] Add test for mergeWith with multi-ref source object. --- test/test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test.js b/test/test.js index 869ce0e8c..4cb704c77 100644 --- a/test/test.js +++ b/test/test.js @@ -14386,6 +14386,20 @@ assert.deepEqual(actual, { 'a': { 'b': ['c'] } }); }); + + QUnit.test('should pop the stack of sources for each sibling property', function(assert) { + assert.expect(1); + + var array = ['b', 'c'], + object = { 'a': ['a'] }, + source = { 'a': array, 'b': array }; + + var actual = _.mergeWith(object, source, function(a, b) { + return lodashStable.isArray(a) ? a.concat(b) : undefined; + }); + + assert.deepEqual(actual, { 'a': ['a', 'b', 'c'], 'b': ['b', 'c'] }); + }); }()); /*--------------------------------------------------------------------------*/