From 9734fd035370380b44f836d37544291bbae4616d Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 18 Feb 2015 01:05:39 -0800 Subject: [PATCH] Increase `_.merge` test coverage. --- test/test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test.js b/test/test.js index 4e79ec401..3632e839c 100644 --- a/test/test.js +++ b/test/test.js @@ -9774,6 +9774,20 @@ deepEqual(actual, expected); }); + test('should assign non array/plain-object values directly', 1, function() { + function Foo() {} + + var values = [new Foo, new Boolean, new Date, Foo, new Number, new String, new RegExp], + expected = _.map(values, _.constant(true)); + + var actual = _.map(values, function(value) { + var object = _.merge({}, { 'a': value }); + return object.a === value; + }); + + deepEqual(actual, expected); + }); + test('should handle merging if `customizer` returns `undefined`', 2, function() { var actual = _.merge({ 'a': { 'b': [1, 1] } }, { 'a': { 'b': [0] } }, _.noop); deepEqual(actual, { 'a': { 'b': [0, 1] } });