mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Cleanup _.toLength tests.
This commit is contained in:
18
test/test.js
18
test/test.js
@@ -19349,15 +19349,7 @@
|
|||||||
QUnit.module('lodash.toLength');
|
QUnit.module('lodash.toLength');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
QUnit.test('should return number literal integers in range unchanged', function(assert) {
|
QUnit.test('should return a valid length', 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.expect(4);
|
||||||
|
|
||||||
assert.strictEqual(_.toLength(-1), 0);
|
assert.strictEqual(_.toLength(-1), 0);
|
||||||
@@ -19365,6 +19357,14 @@
|
|||||||
assert.strictEqual(_.toLength(1.1), 1);
|
assert.strictEqual(_.toLength(1.1), 1);
|
||||||
assert.strictEqual(_.toLength(MAX_INTEGER), MAX_ARRAY_LENGTH);
|
assert.strictEqual(_.toLength(MAX_INTEGER), MAX_ARRAY_LENGTH);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should return `value` if a valid length', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.strictEqual(_.toLength(0), 0);
|
||||||
|
assert.strictEqual(_.toLength(3), 3);
|
||||||
|
assert.strictEqual(_.toLength(MAX_ARRAY_LENGTH), MAX_ARRAY_LENGTH);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user