Add _.pullAllWith test.

This commit is contained in:
John-David Dalton
2016-02-28 12:23:32 -08:00
parent eabe95c4e3
commit 6f470abdff

View File

@@ -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');
lodashStable.each(['pull', 'pullAll'], function(methodName) {
lodashStable.each(['pull', 'pullAll', 'pullAllWith'], function(methodName) {
var func = _[methodName],
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');
(function() {