Skip to content

Commit

Permalink
Add a test to check for null handling in wrapper methods
Browse files Browse the repository at this point in the history
This could be considered a regression test for #2472.
  • Loading branch information
jgonggrijp committed Apr 30, 2020
1 parent 35579bc commit 41baf26
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/chaining.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,14 @@
assert.strictEqual('' + wrapped, '512');
});

QUnit.test('wrapper methods handle undefined and null', function(assert) {
var w1 = _(), w2 = _(null);
_.each([w1, w2], function(wrapped) {
assert.equal(wrapped.extend({a: 1}), void 0);
assert.equal(wrapped.first(), void 0);
assert.equal(wrapped.push(1), void 0);
assert.equal(wrapped.concat([1]), void 0);
});
});

}());

0 comments on commit 41baf26

Please sign in to comment.