From 1a0a9709f28484c1f11cff698cec0050447adb78 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 27 Dec 2015 16:21:21 -0600 Subject: [PATCH] Add tests for chaining `_.invokeMap`. --- test/test.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/test.js b/test/test.js index b5de95d6f..a084b1637 100644 --- a/test/test.js +++ b/test/test.js @@ -7296,6 +7296,29 @@ }); }); + QUnit.test('should return a wrapped value when chaining', function(assert) { + assert.expect(4); + + if (!isNpm) { + var array = ['a', 'b', 'c'], + wrapped = _(array), + actual = wrapped.invokeMap('toUpperCase'); + + assert.ok(actual instanceof _); + assert.deepEqual(actual.valueOf(), ['A', 'B', 'C']); + + actual = wrapped.invokeMap(function(left, right) { + return left + this.toUpperCase() + right; + }, '(', ')'); + + assert.ok(actual instanceof _); + assert.deepEqual(actual.valueOf(), ['(A)', '(B)', '(C)']); + } + else { + skipTest(assert, 4); + } + }); + QUnit.test('should support shortcut fusion', function(assert) { assert.expect(2);