From 041c1b4586f1ee47388a3b69a95bfb770df599f7 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 17 May 2016 23:15:27 -0700 Subject: [PATCH] Simplify find tests `expected`. --- test/test.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/test.js b/test/test.js index c2e50ee31..df14ec93c 100644 --- a/test/test.js +++ b/test/test.js @@ -5748,12 +5748,12 @@ ]; var expected = ({ - 'find': [objects[1], undefined, objects[2], objects[1]], - 'findLast': [objects[2], undefined, objects[2], objects[2]], - 'findIndex': [1, -1, 2, 1], - 'findLastIndex': [2, -1, 2, 2], - 'findKey': ['1', undefined, '2', '1'], - 'findLastKey': ['2', undefined, '2', '2'] + 'find': [objects[1], undefined, objects[2]], + 'findLast': [objects[2], undefined, objects[2]], + 'findIndex': [1, -1, 2], + 'findLastIndex': [2, -1, 2], + 'findKey': ['1', undefined, '2'], + 'findLastKey': ['2', undefined, '2'] })[methodName]; QUnit.test('`_.' + methodName + '` should return the found value', function(assert) { @@ -5783,7 +5783,7 @@ QUnit.test('`_.' + methodName + '` should work with `_.property` shorthands', function(assert) { assert.expect(1); - assert.strictEqual(func(objects, 'b'), expected[3]); + assert.strictEqual(func(objects, 'b'), expected[0]); }); QUnit.test('`_.' + methodName + '` should return `' + expected[1] + '` for empty collections', function(assert) { @@ -5805,18 +5805,18 @@ (function() { var array = [1, 2, 3, 4]; - var expected = ({ - 'find': 1, - 'findLast': 4, - 'findIndex': 0, - 'findLastIndex': 3, - 'findKey': '0', - 'findLastKey': '3' - })[methodName]; - QUnit.test('`_.' + methodName + '` should return an unwrapped value when implicitly chaining', function(assert) { assert.expect(1); + var expected = ({ + 'find': 1, + 'findLast': 4, + 'findIndex': 0, + 'findLastIndex': 3, + 'findKey': '0', + 'findLastKey': '3' + })[methodName]; + if (!isNpm) { assert.strictEqual(_(array)[methodName](), expected); }