mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Add _#toString test for nullish values.
This commit is contained in:
19
test/test.js
19
test/test.js
@@ -20602,6 +20602,25 @@
|
||||
skipTest(assert);
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test('should treat nullish values as empty strings', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
if (!isNpm) {
|
||||
var values = [, null, undefined],
|
||||
expected = _.map(values, _.constant(''));
|
||||
|
||||
var actual = _.map(values, function(value, index) {
|
||||
var wrapped = index ? _(value) : _();
|
||||
return String(wrapped);
|
||||
});
|
||||
|
||||
assert.deepEqual(actual, expected);
|
||||
}
|
||||
else {
|
||||
skipTest(assert);
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user