mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Add failing tests for #2367.
This commit is contained in:
50
test/test.js
50
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);
|
||||
});
|
||||
}
|
||||
}());
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user