Ensure _.sum provides the correct arguments when iterating an object.

This commit is contained in:
jdalton
2015-03-15 19:29:58 -07:00
parent c58c0df30e
commit 4c1819c7dd
2 changed files with 38 additions and 11 deletions

View File

@@ -13515,6 +13515,23 @@
deepEqual(actual, 6);
});
test('should provide the correct `iteratee` arguments', 2, function() {
var args;
_.sum(array, function() {
args || (args = slice.call(arguments));
});
deepEqual(args, [6, 0, array]);
args = null;
_.sum(object, function() {
args || (args = slice.call(arguments));
});
deepEqual(args, [2, 'a', object]);
});
test('should support the `thisArg` argument', 1, function() {
var actual = _.sum([6.8, 4.5, 2.6], function(num) {
return this.floor(num);