mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Cleanup _.max and _.min unit tests.
Former-commit-id: 5bfdd6d441f20879f3352f260b9b08e714c7b836
This commit is contained in:
29
test/test.js
29
test/test.js
@@ -246,24 +246,25 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
_.each(['max', 'min'], function(methodName) {
|
(function() {
|
||||||
QUnit.module('lodash.' + methodName);
|
var i = -1,
|
||||||
|
largeArray = [];
|
||||||
|
|
||||||
test('does not error when computing the ' + methodName + ' value of massive arrays', function() {
|
while (++i <= 1e6) {
|
||||||
var actual,
|
largeArray[i] = i;
|
||||||
array = [],
|
}
|
||||||
i = -1;
|
_.each(['max', 'min'], function(methodName) {
|
||||||
|
QUnit.module('lodash.' + methodName);
|
||||||
|
|
||||||
while (++i <= 1e6) {
|
test('does not error when computing the ' + methodName + ' value of massive arrays', function() {
|
||||||
array[i] = i;
|
try {
|
||||||
}
|
var actual = _[methodName](largeArray);
|
||||||
try {
|
} catch(e) { }
|
||||||
actual = _[methodName](array);
|
|
||||||
} catch(e) { }
|
|
||||||
|
|
||||||
equal(actual, methodName == 'max' ? 1e6 : 0);
|
equal(actual, methodName == 'max' ? 1e6 : 0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user