From 5c42d0ef31502a202ab33f4e6b763f5ea1ba3337 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 21 Feb 2016 09:59:51 -0800 Subject: [PATCH] Add intersection tests for two arrays. --- test/test.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index 01674141f..a934e5a09 100644 --- a/test/test.js +++ b/test/test.js @@ -7533,11 +7533,24 @@ var args = (function() { return arguments; }(1, 2, 3)), func = _[methodName]; - QUnit.test('`_.' + methodName + '` should return the intersection of the given arrays', function(assert) { - assert.expect(1); + QUnit.test('`_.' + methodName + '` should return the intersection of two arrays', function(assert) { + assert.expect(2); + + var actual = func([1, 3, 2], [5, 2, 1, 4]); + assert.deepEqual(actual, [1, 2]); + + actual = func([5, 2, 1, 4], [1, 3, 2]); + assert.deepEqual(actual, [2, 1]); + }); + + QUnit.test('`_.' + methodName + '` should return the intersection of multiple arrays', function(assert) { + assert.expect(2); var actual = func([1, 3, 2], [5, 2, 1, 4], [2, 1]); assert.deepEqual(actual, [1, 2]); + + actual = func([5, 2, 1, 4], [2, 1], [1, 3, 2]); + assert.deepEqual(actual, [2, 1]); }); QUnit.test('`_.' + methodName + '` should return an array of unique values', function(assert) {