mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Add more _.chunk tests.
This commit is contained in:
17
test/test.js
17
test/test.js
@@ -1226,9 +1226,15 @@
|
|||||||
deepEqual(actual, [[0, 1, 2, 3], [4, 5]]);
|
deepEqual(actual, [[0, 1, 2, 3], [4, 5]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should ignore falsey values', 1, function() {
|
test('should ensure the minimum `chunkSize` is `1`', 1, function() {
|
||||||
var actual = _.chunk(false, 3);
|
var values = falsey.concat(-1),
|
||||||
deepEqual(actual, []);
|
expected = _.map(values, _.constant([[0], [1], [2], [3], [4], [5]]));
|
||||||
|
|
||||||
|
var actual = _.map(values, function(value, index) {
|
||||||
|
return index ? _.chunk(array, value) : _.chunk(array);
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -10883,6 +10889,7 @@
|
|||||||
|
|
||||||
var returnArrays = [
|
var returnArrays = [
|
||||||
'at',
|
'at',
|
||||||
|
'chunk',
|
||||||
'compact',
|
'compact',
|
||||||
'difference',
|
'difference',
|
||||||
'filter',
|
'filter',
|
||||||
@@ -10937,7 +10944,7 @@
|
|||||||
|
|
||||||
var acceptFalsey = _.difference(allMethods, rejectFalsey);
|
var acceptFalsey = _.difference(allMethods, rejectFalsey);
|
||||||
|
|
||||||
test('should accept falsey arguments', 188, function() {
|
test('should accept falsey arguments', 189, function() {
|
||||||
var emptyArrays = _.map(falsey, _.constant([])),
|
var emptyArrays = _.map(falsey, _.constant([])),
|
||||||
isExposed = '_' in root,
|
isExposed = '_' in root,
|
||||||
oldDash = root._;
|
oldDash = root._;
|
||||||
@@ -10980,7 +10987,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return an array', 66, function() {
|
test('should return an array', 68, function() {
|
||||||
var array = [1, 2, 3];
|
var array = [1, 2, 3];
|
||||||
|
|
||||||
_.each(returnArrays, function(methodName) {
|
_.each(returnArrays, function(methodName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user