Add unit tests for passing falsey values to _.initial and _.rest.

Former-commit-id: 9d5d4960c175a3dd90af977b605ce309bc6446d3
This commit is contained in:
John-David Dalton
2012-10-03 20:12:03 -07:00
parent 07b9ca457f
commit a210377f35

View File

@@ -646,6 +646,15 @@
var array = [1, 2, 3];
deepEqual(_.initial(array, 0), []);
});
test('should allow a falsey `array` argument', function() {
_.each(falsey, function(index, value) {
try {
var actual = index ? _.initial(value) : _.initial();
} catch(e) { }
deepEqual(actual, []);
})
});
}());
/*--------------------------------------------------------------------------*/
@@ -1291,6 +1300,21 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.rest');
(function() {
test('should allow a falsey `array` argument', function() {
_.each(falsey, function(index, value) {
try {
var actual = index ? _.rest(value) : _.rest();
} catch(e) { }
deepEqual(actual, []);
})
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.size');
(function() {