From 32b813e42b9c61d960d44665b61e8b5df06fe84c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 21 Apr 2016 00:44:23 -0700 Subject: [PATCH] Ensure `sortedIndex` methods align with `sortBy` for symbols. --- test/test.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/test.js b/test/test.js index 201084897..0df49abb8 100644 --- a/test/test.js +++ b/test/test.js @@ -20437,19 +20437,22 @@ }); QUnit.test('`_.' + methodName + '` should align with `_.sortBy`', function(assert) { - assert.expect(10); + assert.expect(12); - var expected = [1, '2', {}, null, undefined, NaN, NaN]; + var symbol1 = Symbol ? Symbol('a') : null, + symbol2 = Symbol ? Symbol('b') : null, + expected = [1, '2', {}, symbol1, symbol2, null, undefined, NaN, NaN]; lodashStable.each([ - [NaN, null, 1, '2', {}, NaN, undefined], - ['2', null, 1, NaN, {}, NaN, undefined] + [NaN, symbol1, null, 1, '2', {}, symbol2, NaN, undefined], + ['2', null, 1, symbol1, NaN, {}, NaN, symbol2, undefined] ], function(array) { assert.deepEqual(_.sortBy(array), expected); assert.strictEqual(func(expected, 3), 2); - assert.strictEqual(func(expected, null), isSortedIndex ? 3 : 4); - assert.strictEqual(func(expected, undefined), isSortedIndex ? 4 : 5); - assert.strictEqual(func(expected, NaN), isSortedIndex ? 5 : 7); + assert.strictEqual(func(expected, symbol1), (isSortedIndex ? 3 : (Symbol ? 5 : 6))); + assert.strictEqual(func(expected, null), (isSortedIndex ? (Symbol ? 5 : 3) : 6)); + assert.strictEqual(func(expected, undefined), isSortedIndex ? 6 : 7); + assert.strictEqual(func(expected, NaN), isSortedIndex ? 7 : 9); }); }); });