mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Add intersection tests for two arrays.
This commit is contained in:
17
test/test.js
17
test/test.js
@@ -7533,11 +7533,24 @@
|
|||||||
var args = (function() { return arguments; }(1, 2, 3)),
|
var args = (function() { return arguments; }(1, 2, 3)),
|
||||||
func = _[methodName];
|
func = _[methodName];
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should return the intersection of the given arrays', function(assert) {
|
QUnit.test('`_.' + methodName + '` should return the intersection of two arrays', function(assert) {
|
||||||
assert.expect(1);
|
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]);
|
var actual = func([1, 3, 2], [5, 2, 1, 4], [2, 1]);
|
||||||
assert.deepEqual(actual, [1, 2]);
|
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) {
|
QUnit.test('`_.' + methodName + '` should return an array of unique values', function(assert) {
|
||||||
|
|||||||
Reference in New Issue
Block a user