From 78a157d675d4f015165fb8a280c601562ab6fee7 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 12 Apr 2016 21:30:06 -0700 Subject: [PATCH] Move `_.map` test order around. --- test/test.js | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/test/test.js b/test/test.js index 81bd585d8..c647fcd65 100644 --- a/test/test.js +++ b/test/test.js @@ -2865,21 +2865,6 @@ } }); - QUnit.test('`_.' + methodName + '` should perform a ' + (isDeep ? 'deep' : 'shallow') + ' clone when used as an iteratee for methods like `_.map`', function(assert) { - assert.expect(2); - - var expected = [{ 'a': [0] }, { 'b': [1] }], - actual = lodashStable.map(expected, func); - - assert.deepEqual(actual, expected); - - if (isDeep) { - assert.ok(actual[0] !== expected[0] && actual[0].a !== expected[0].a && actual[1].b !== expected[1].b); - } else { - assert.ok(actual[0] !== expected[0] && actual[0].a === expected[0].a && actual[1].b === expected[1].b); - } - }); - QUnit.test('`_.' + methodName + '` should create an object from the same realm as `value`', function(assert) { assert.expect(1); @@ -2906,6 +2891,21 @@ assert.deepEqual(actual, expected, props.join(', ')); }); + QUnit.test('`_.' + methodName + '` should perform a ' + (isDeep ? 'deep' : 'shallow') + ' clone when used as an iteratee for methods like `_.map`', function(assert) { + assert.expect(2); + + var expected = [{ 'a': [0] }, { 'b': [1] }], + actual = lodashStable.map(expected, func); + + assert.deepEqual(actual, expected); + + if (isDeep) { + assert.ok(actual[0] !== expected[0] && actual[0].a !== expected[0].a && actual[1].b !== expected[1].b); + } else { + assert.ok(actual[0] !== expected[0] && actual[0].a === expected[0].a && actual[1].b === expected[1].b); + } + }); + QUnit.test('`_.' + methodName + '` should return a unwrapped value when chaining', function(assert) { assert.expect(2); @@ -3993,6 +3993,18 @@ assert.strictEqual(actual, 3); }); + QUnit.test('`_.' + methodName + '` should work for function names that shadow those on `Object.prototype`', function(assert) { + assert.expect(1); + + var curried = _.curry(function hasOwnProperty(a, b, c) { + return [a, b, c]; + }); + + var expected = [1, 2, 3]; + + assert.deepEqual(curried(1)(2)(3), expected); + }); + QUnit.test('`_.' + methodName + '` should work as an iteratee for methods like `_.map`', function(assert) { assert.expect(2); @@ -4010,18 +4022,6 @@ assert.deepEqual(actual, expected); }); }); - - QUnit.test('`_.' + methodName + '` should work for function names that shadow those on `Object.prototype`', function(assert) { - assert.expect(1); - - var curried = _.curry(function hasOwnProperty(a, b, c) { - return [a, b, c]; - }); - - var expected = [1, 2, 3]; - - assert.deepEqual(curried(1)(2)(3), expected); - }); }); /*--------------------------------------------------------------------------*/ @@ -24319,15 +24319,6 @@ assert.deepEqual(_.words('abcd', 'ab|cd'), ['ab']); }); - QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) { - assert.expect(1); - - var strings = lodashStable.map(['a', 'b', 'c'], Object), - actual = lodashStable.map(strings, _.words); - - assert.deepEqual(actual, [['a'], ['b'], ['c']]); - }); - QUnit.test('should work with compound words', function(assert) { assert.expect(12); @@ -24352,6 +24343,15 @@ assert.deepEqual(_.words('æiouAreVowels'), ['æiou', 'Are', 'Vowels']); assert.deepEqual(_.words('æiou2Consonants'), ['æiou', '2', 'Consonants']); }); + + QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) { + assert.expect(1); + + var strings = lodashStable.map(['a', 'b', 'c'], Object), + actual = lodashStable.map(strings, _.words); + + assert.deepEqual(actual, [['a'], ['b'], ['c']]); + }); }()); /*--------------------------------------------------------------------------*/