From a21b25f751a3eb45da85a271e9a814cd8b947483 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 7 Oct 2015 00:18:42 -0700 Subject: [PATCH] Add `_.differenceBy`, `_.intersectionBy`, `_.pickAllBy`, `_.unionBy`, and `_.xorBy` tests. --- test/test.js | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index e04aa58fa..5a44bebb1 100644 --- a/test/test.js +++ b/test/test.js @@ -10073,6 +10073,19 @@ } }); + QUnit.test('`_.differenceBy` should use `_.iteratee` internally', function(assert) { + assert.expect(1); + + if (!isModularize) { + _.iteratee = getPropA; + assert.deepEqual(_.differenceBy(objects, [objects[1]]), [objects[0]]); + _.iteratee = iteratee; + } + else { + skipTest(assert); + } + }); + QUnit.test('`_.dropRightWhile` should use `_.iteratee` internally', function(assert) { assert.expect(1); @@ -10179,7 +10192,7 @@ } }); - QUnit.test('`_.findLastKey` should use `_.iteratee` internally', function(assert) { + QUnit.test('`_.findKey` should use `_.iteratee` internally', function(assert) { assert.expect(1); if (!isModularize) { @@ -10192,7 +10205,7 @@ } }); - QUnit.test('`_.findKey` should use `_.iteratee` internally', function(assert) { + QUnit.test('`_.findLastKey` should use `_.iteratee` internally', function(assert) { assert.expect(1); if (!isModularize) { @@ -10218,6 +10231,19 @@ } }); + QUnit.test('`_.intersectionBy` should use `_.iteratee` internally', function(assert) { + assert.expect(1); + + if (!isModularize) { + _.iteratee = getPropA; + assert.deepEqual(_.intersectionBy(objects, [objects[2]]), [objects[1]]); + _.iteratee = iteratee; + } + else { + skipTest(assert); + } + }); + QUnit.test('`_.keyBy` should use `_.iteratee` internally', function(assert) { assert.expect(1); @@ -10311,6 +10337,19 @@ } }); + QUnit.test('`_.pullAllBy` should use `_.iteratee` internally', function(assert) { + assert.expect(1); + + if (!isModularize) { + _.iteratee = getPropA; + assert.deepEqual(_.pullAllBy(objects.slice(), [{ 'a': 1, 'b': 0 }]), [objects[0]]); + _.iteratee = iteratee; + } + else { + skipTest(assert); + } + }); + QUnit.test('`_.reduce` should use `_.iteratee` internally', function(assert) { assert.expect(1); @@ -10493,6 +10532,32 @@ skipTest(assert); } }); + + QUnit.test('`_.unionBy` should use `_.iteratee` internally', function(assert) { + assert.expect(1); + + if (!isModularize) { + _.iteratee = getPropB; + assert.deepEqual(_.unionBy(objects.slice(0, 1), [objects[2]]), [objects[0], objects[2]]); + _.iteratee = iteratee; + } + else { + skipTest(assert); + } + }); + + QUnit.test('`_.xorBy` should use `_.iteratee` internally', function(assert) { + assert.expect(1); + + if (!isModularize) { + _.iteratee = getPropA; + assert.deepEqual(_.xorBy(objects, objects.slice(1)), [objects[0]]); + _.iteratee = iteratee; + } + else { + skipTest(assert); + } + }); }()); /*--------------------------------------------------------------------------*/