Ensure _.divide and _.multiply return 1 when no arguments are specified. [closes #2405]

This commit is contained in:
John-David Dalton
2016-06-06 15:58:24 -07:00
parent 2f6b2ca0c7
commit 21df7426e2
2 changed files with 11 additions and 9 deletions

View File

@@ -21217,12 +21217,13 @@
QUnit.module('math operator methods');
lodashStable.each(['add', 'divide', 'multiply', 'subtract'], function(methodName) {
var func = _[methodName];
var func = _[methodName],
isAddSub = methodName == 'add' || methodName == 'subtract';
QUnit.test('`_.' + methodName + '` should return `0` when no arguments are given', function(assert) {
QUnit.test('`_.' + methodName + '` should return `' + (isAddSub ? 0 : 1) + '` when no arguments are given', function(assert) {
assert.expect(1);
assert.strictEqual(func(), 0);
assert.strictEqual(func(), isAddSub ? 0 : 1);
});
QUnit.test('`_.' + methodName + '` should work with only one defined argument', function(assert) {