Cleanup _.merge tests for function properties.

This commit is contained in:
John-David Dalton
2018-08-30 22:58:11 -07:00
parent 79b9d20a91
commit 278c6dd33d
2 changed files with 12 additions and 11 deletions

View File

@@ -14830,7 +14830,7 @@
}());
/*--------------------------------------------------------------------------*/
// sina
QUnit.module('lodash.merge');
(function() {
@@ -14914,9 +14914,9 @@
QUnit.test('should merge first source object properties to function', function(assert) {
assert.expect(1);
const Foo = function () {};
var object = { prop: {} },
actual = _.merge({prop: Foo}, object);
var fn = function() {},
object = { 'prop': {} },
actual = _.merge({ 'prop': fn }, object);
assert.deepEqual(actual, object);
});
@@ -14924,24 +14924,26 @@
QUnit.test('should merge first and second source object properties to function', function(assert) {
assert.expect(1);
const fn = function () {};
var object = { prop: {} },
actual = _.merge({prop: fn}, {prop: fn}, object);
var fn = function() {},
object = { 'prop': {} },
actual = _.merge({ 'prop': fn }, { 'prop': fn }, object);
assert.deepEqual(actual, object);
});
QUnit.test('should not merge onto function values of sources', function(assert) {
assert.expect(2);
assert.expect(3);
var source1 = { 'a': function() {} },
source2 = { 'a': { 'b': 2 } },
expected = { 'a': { 'b': 2 } },
actual = _.merge({}, source1, source2);
assert.deepEqual(actual, { 'a': { 'b': 2 } });
assert.deepEqual(actual, expected);
assert.notOk('b' in source1.a);
actual = _.merge(source1, source2);
assert.strictEqual(actual.a.b, 2);
assert.deepEqual(actual, expected);
});
QUnit.test('should merge onto non-plain `object` values', function(assert) {