Add _.toInteger tests.

This commit is contained in:
John-David Dalton
2015-09-05 09:30:52 -07:00
parent a4fee3a3ad
commit ded3cfc251
2 changed files with 15 additions and 2 deletions

View File

@@ -8890,8 +8890,8 @@
* _.toInteger(NaN);
* // => 0
*
* _.toInteger(Infinity);
* // => Infinity
* _.toInteger(-Infinity);
* // => -Infinity
*/
function toInteger(value) {
return nativeFloor(value) || 0;

View File

@@ -15632,6 +15632,19 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.toInteger');
(function() {
test('should convert values to integers', 4, function() {
strictEqual(_.toInteger('3.14'), 3);
strictEqual(_.toInteger(), 0);
strictEqual(_.toInteger(NaN), 0);
strictEqual(_.toInteger(-Infinity), -Infinity);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.toPlainObject');
(function() {