From b1a81a85b13f505b69c432065c4bbbbe33903fb7 Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 25 Mar 2015 21:49:35 -0700 Subject: [PATCH] Add a test for `_.remove` and `index` params. --- test/test.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/test.js b/test/test.js index 79ee74008..7f7abff6a 100644 --- a/test/test.js +++ b/test/test.js @@ -12359,14 +12359,17 @@ }); test('should provide the correct `predicate` arguments', 1, function() { - var args, - array = [1, 2, 3]; + var argsList = [], + array = [1, 2, 3, 4]; - _.remove(array, function() { - args || (args = slice.call(arguments)); + _.remove(array, function(value, index) { + var args = slice.call(arguments); + args[2] = args[2].slice(); + argsList.push(args); + return index % 2; }); - deepEqual(args, [1, 0, array]); + deepEqual(argsList, [[1, 0, [1, 2, 3, 4]], [2, 1, [1, 2, 3, 4]], [3, 1, [1, 3, 4]], [4, 1, [1, 4]]]); }); test('should support the `thisArg` argument', 1, function() {