From 0c050bb266fb1e4746c2603828da277f83f8d34a Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 25 Jan 2015 12:13:28 -0800 Subject: [PATCH] Add `_.uniq` test for arguments provided to `iteratee`. --- test/test.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index 2eb3a2b6c..c6e330608 100644 --- a/test/test.js +++ b/test/test.js @@ -9052,7 +9052,7 @@ strictEqual(func([curr, past]), isMax ? curr : past); }); - test('`_.' + methodName + '` should work with a `iteratee` argument', 1, function() { + test('`_.' + methodName + '` should work with an `iteratee` argument', 1, function() { var actual = func(array, function(num) { return -num; }); @@ -13578,7 +13578,7 @@ deepEqual(_.uniq([1, 2, 3, 3, 3, 3, 3], true), expected); }); - test('should work with `iteratee`', 2, function() { + test('should work with an `iteratee` argument', 2, function() { _.each([objects, _.sortBy(objects, 'a')], function(array, index) { var isSorted = !!index, expected = isSorted ? [objects[2], objects[0], objects[1]] : objects.slice(0, 3); @@ -13591,6 +13591,16 @@ }); }); + test('should provide the correct `iteratee` arguments', 1, function() { + var args; + + _.uniq(objects, function() { + args || (args = slice.call(arguments)); + }); + + deepEqual(args, [objects[0], 0, objects]); + }); + test('should work with `iteratee` without specifying `isSorted`', 1, function() { var actual = _.uniq(objects, function(object) { return object.a;