Skip to content

Commit 278c6dd

Browse files
committed
Cleanup _.merge tests for function properties.
1 parent 79b9d20 commit 278c6dd

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
*.log
33
doc/*.html
44
node_modules
5-
.idea

test/test.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14830,7 +14830,7 @@
1483014830
}());
1483114831

1483214832
/*--------------------------------------------------------------------------*/
14833-
// sina
14833+
1483414834
QUnit.module('lodash.merge');
1483514835

1483614836
(function() {
@@ -14914,34 +14914,36 @@
1491414914
QUnit.test('should merge first source object properties to function', function(assert) {
1491514915
assert.expect(1);
1491614916

14917-
const Foo = function () {};
14918-
var object = { prop: {} },
14919-
actual = _.merge({prop: Foo}, object);
14917+
var fn = function() {},
14918+
object = { 'prop': {} },
14919+
actual = _.merge({ 'prop': fn }, object);
1492014920

1492114921
assert.deepEqual(actual, object);
1492214922
});
1492314923

1492414924
QUnit.test('should merge first and second source object properties to function', function(assert) {
1492514925
assert.expect(1);
1492614926

14927-
const fn = function () {};
14928-
var object = { prop: {} },
14929-
actual = _.merge({prop: fn}, {prop: fn}, object);
14927+
var fn = function() {},
14928+
object = { 'prop': {} },
14929+
actual = _.merge({ 'prop': fn }, { 'prop': fn }, object);
1493014930

1493114931
assert.deepEqual(actual, object);
1493214932
});
1493314933

1493414934
QUnit.test('should not merge onto function values of sources', function(assert) {
14935-
assert.expect(2);
14935+
assert.expect(3);
1493614936

1493714937
var source1 = { 'a': function() {} },
1493814938
source2 = { 'a': { 'b': 2 } },
14939+
expected = { 'a': { 'b': 2 } },
1493914940
actual = _.merge({}, source1, source2);
1494014941

14941-
assert.deepEqual(actual, { 'a': { 'b': 2 } });
14942+
assert.deepEqual(actual, expected);
14943+
assert.notOk('b' in source1.a);
1494214944

1494314945
actual = _.merge(source1, source2);
14944-
assert.strictEqual(actual.a.b, 2);
14946+
assert.deepEqual(actual, expected);
1494514947
});
1494614948

1494714949
QUnit.test('should merge onto non-plain `object` values', function(assert) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy