diff --git a/test/test.js b/test/test.js index b63a08c73..b979b622e 100644 --- a/test/test.js +++ b/test/test.js @@ -5814,6 +5814,32 @@ }); }()); + (function() { + var array = [1, 2, 3, 4]; + + var expected = ({ + 'find': [0, 1, 2, 3], + 'findLast': [3, 2, 1, 0], + 'findIndex': [0, 1, 2, 3], + 'findLastIndex': [3, 2, 1, 0] + })[methodName]; + + if (expected != null) { + QUnit.test('`_.' + methodName + '` should pass the index as the second argument for `iteratee`', function(assert) { + assert.expect(1); + + var actual = []; + + func(array, function(n, index) { + actual.push(index); + return false; + }); + + assert.deepEqual(actual, expected); + }); + } + }()); + (function() { var array = [1, 2, 3, 4]; @@ -5900,6 +5926,30 @@ }); } }()); + + (function() { + var expected = ({ + 'find': ['a', 'b', 'c'], + 'findLast': ['c', 'b', 'a'], + 'findKey': ['a', 'b', 'c'], + 'findLastKey': ['c', 'b', 'a'] + })[methodName]; + + if (expected != null) { + QUnit.test('`_.' + methodName + '` should pass the key as the second argument for `iteratee`', function(assert) { + assert.expect(1); + + var actual = []; + + func({ 'a': 1, 'b': 2, 'c': 3 }, function(n, key) { + actual.push(key); + return false; + }); + + assert.deepEqual(actual, expected); + }); + } + }()); }); /*--------------------------------------------------------------------------*/