mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Ensure _.sortedIndex and _.sortedLastIndex align with _.sortBy.
This commit is contained in:
20
test/test.js
20
test/test.js
@@ -9684,7 +9684,25 @@
|
||||
strictEqual(actual, 1);
|
||||
});
|
||||
|
||||
test('`_.' + methodName + '` supports arrays with lengths larger than `Math.pow(2, 31) - 1`', 1, function() {
|
||||
test('`_.' + methodName + '` should align with `_.sortBy`', 8, function() {
|
||||
var array = [NaN, {}, NaN, 1, 2, undefined];
|
||||
deepEqual(_.sortBy(array), array);
|
||||
strictEqual(func(array, 3), 5);
|
||||
|
||||
array = [1, 2, NaN, {}, NaN, undefined];
|
||||
deepEqual(_.sortBy(array), array);
|
||||
strictEqual(func(array, 3), 5);
|
||||
|
||||
array = [NaN, {}, NaN, '1', '2', undefined];
|
||||
deepEqual(_.sortBy(array), array);
|
||||
strictEqual(func(array, '3'), 5);
|
||||
|
||||
array = ['1', '2', NaN, {}, NaN, undefined];
|
||||
deepEqual(_.sortBy(array), array);
|
||||
strictEqual(func(array, '3'), 2);
|
||||
});
|
||||
|
||||
test('`_.' + methodName + '` should support arrays larger than `Math.pow(2, 31) - 1`', 1, function() {
|
||||
var length = Math.pow(2, 32) - 1,
|
||||
index = length - 1,
|
||||
array = Array(length),
|
||||
|
||||
Reference in New Issue
Block a user