Add failing tests for #2367.

This commit is contained in:
John-David Dalton
2016-05-23 08:38:46 -07:00
parent 90d07bc04c
commit a2617d810c

View File

@@ -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);
});
}
}());
});
/*--------------------------------------------------------------------------*/