Skip to content

Commit 2a548a9

Browse files
committed
[Tests] utils.merge: add some coverage
1 parent 3e750c1 commit 2a548a9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/utils.js

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ test('merge()', function (t) {
2828
var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar');
2929
t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true });
3030

31+
var func = function f() {};
32+
t.deepEqual(
33+
utils.merge(func, { foo: 'bar' }),
34+
[func, { foo: 'bar' }],
35+
'functions can not be merged into'
36+
);
37+
38+
func.bar = 'baz';
39+
t.deepEqual(
40+
utils.merge({ foo: 'bar' }, func),
41+
{ foo: 'bar', 'function f() {}': true },
42+
'functions can not be merge sources'
43+
);
44+
3145
t.test(
3246
'avoids invoking array setters unnecessarily',
3347
{ skip: typeof Object.defineProperty !== 'function' },

0 commit comments

Comments
 (0)