mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Expose _.toLength.
This commit is contained in:
committed by
John-David Dalton
parent
c7ef030ef5
commit
2b4a10c159
25
test/test.js
25
test/test.js
@@ -19338,6 +19338,29 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.toLength');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should return number literal integers in range unchanged', function(assert) {
|
||||
assert.expect(3);
|
||||
|
||||
assert.strictEqual(_.toLength(0), 0);
|
||||
assert.strictEqual(_.toLength(3), 3);
|
||||
assert.strictEqual(_.toLength(MAX_ARRAY_LENGTH), MAX_ARRAY_LENGTH);
|
||||
});
|
||||
|
||||
QUnit.test('should return number as integer clamped to range', function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
assert.strictEqual(_.toLength(-1), 0);
|
||||
assert.strictEqual(_.toLength('1'), 1);
|
||||
assert.strictEqual(_.toLength(1.1), 1);
|
||||
assert.strictEqual(_.toLength(MAX_INTEGER), MAX_ARRAY_LENGTH);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.toPath');
|
||||
|
||||
(function() {
|
||||
@@ -22023,7 +22046,7 @@
|
||||
var acceptFalsey = lodashStable.difference(allMethods, rejectFalsey);
|
||||
|
||||
QUnit.test('should accept falsey arguments', function(assert) {
|
||||
assert.expect(273);
|
||||
assert.expect(274);
|
||||
|
||||
var emptyArrays = lodashStable.map(falsey, lodashStable.constant([]));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user