Increase _.merge test coverage.

This commit is contained in:
jdalton
2015-02-18 01:05:39 -08:00
parent 6209c120c0
commit 9734fd0353

View File

@@ -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] } });