Skip to content

Commit

Permalink
[Tests] utils.merge: add some coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 22, 2024
1 parent 3e750c1 commit 2a548a9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ test('merge()', function (t) {
var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar');
t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true });

var func = function f() {};
t.deepEqual(
utils.merge(func, { foo: 'bar' }),
[func, { foo: 'bar' }],
'functions can not be merged into'
);

func.bar = 'baz';
t.deepEqual(
utils.merge({ foo: 'bar' }, func),
{ foo: 'bar', 'function f() {}': true },
'functions can not be merge sources'
);

t.test(
'avoids invoking array setters unnecessarily',
{ skip: typeof Object.defineProperty !== 'function' },
Expand Down

0 comments on commit 2a548a9

Please sign in to comment.