mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Add _.pullAllWith test.
This commit is contained in:
64
test/test.js
64
test/test.js
@@ -16777,9 +16777,40 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.pullAllBy');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should accept an `iteratee` argument', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
||||||
|
|
||||||
|
var actual = _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], function(object) {
|
||||||
|
return object.x;
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(actual, [{ 'x': 2 }]);
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var args,
|
||||||
|
array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
||||||
|
|
||||||
|
_.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], function() {
|
||||||
|
args || (args = slice.call(arguments));
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(args, [{ 'x': 1 }]);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('pull methods');
|
QUnit.module('pull methods');
|
||||||
|
|
||||||
lodashStable.each(['pull', 'pullAll'], function(methodName) {
|
lodashStable.each(['pull', 'pullAll', 'pullAllWith'], function(methodName) {
|
||||||
var func = _[methodName],
|
var func = _[methodName],
|
||||||
isPull = methodName == 'pull';
|
isPull = methodName == 'pull';
|
||||||
|
|
||||||
@@ -16833,37 +16864,6 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.pullAllBy');
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
QUnit.test('should accept an `iteratee` argument', function(assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
|
|
||||||
var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
|
||||||
|
|
||||||
var actual = _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], function(object) {
|
|
||||||
return object.x;
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.deepEqual(actual, [{ 'x': 2 }]);
|
|
||||||
});
|
|
||||||
|
|
||||||
QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
|
|
||||||
var args,
|
|
||||||
array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
|
||||||
|
|
||||||
_.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], function() {
|
|
||||||
args || (args = slice.call(arguments));
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.deepEqual(args, [{ 'x': 1 }]);
|
|
||||||
});
|
|
||||||
}());
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
QUnit.module('lodash.pullAt');
|
QUnit.module('lodash.pullAt');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user