mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Cleanup "With" tests.
This commit is contained in:
37
test/test.js
37
test/test.js
@@ -4654,13 +4654,13 @@
|
|||||||
QUnit.module('lodash.differenceWith');
|
QUnit.module('lodash.differenceWith');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
||||||
|
|
||||||
QUnit.test('should work with a `comparator` argument', function(assert) {
|
QUnit.test('should work with a `comparator` argument', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var actual = _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], lodashStable.isEqual);
|
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }],
|
||||||
assert.deepEqual(actual, [{ 'x': 2, 'y': 1 }]);
|
actual = _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], lodashStable.isEqual);
|
||||||
|
|
||||||
|
assert.deepEqual(actual, [objects[1]]);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -7761,15 +7761,14 @@
|
|||||||
QUnit.module('lodash.intersectionWith');
|
QUnit.module('lodash.intersectionWith');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
||||||
|
|
||||||
QUnit.test('should work with a `comparator` argument', function(assert) {
|
QUnit.test('should work with a `comparator` argument', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }],
|
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }],
|
||||||
|
others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }],
|
||||||
actual = _.intersectionWith(objects, others, lodashStable.isEqual);
|
actual = _.intersectionWith(objects, others, lodashStable.isEqual);
|
||||||
|
|
||||||
assert.deepEqual(actual, [{ 'x': 1, 'y': 2 }]);
|
assert.deepEqual(actual, [objects[0]]);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -22617,15 +22616,14 @@
|
|||||||
QUnit.module('lodash.unionWith');
|
QUnit.module('lodash.unionWith');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
||||||
|
|
||||||
QUnit.test('should work with a `comparator` argument', function(assert) {
|
QUnit.test('should work with a `comparator` argument', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }],
|
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }],
|
||||||
|
others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }],
|
||||||
actual = _.unionWith(objects, others, lodashStable.isEqual);
|
actual = _.unionWith(objects, others, lodashStable.isEqual);
|
||||||
|
|
||||||
assert.deepEqual(actual, [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]);
|
assert.deepEqual(actual, [objects[0], objects[1], others[0]]);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -22764,13 +22762,13 @@
|
|||||||
QUnit.module('lodash.uniqWith');
|
QUnit.module('lodash.uniqWith');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
||||||
|
|
||||||
QUnit.test('should work with a `comparator` argument', function(assert) {
|
QUnit.test('should work with a `comparator` argument', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var actual = _.uniqWith(objects, lodashStable.isEqual);
|
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }],
|
||||||
assert.deepEqual(actual, [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]);
|
actual = _.uniqWith(objects, lodashStable.isEqual);
|
||||||
|
|
||||||
|
assert.deepEqual(actual, [objects[0], objects[1]]);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -23441,15 +23439,14 @@
|
|||||||
QUnit.module('lodash.xorWith');
|
QUnit.module('lodash.xorWith');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
||||||
|
|
||||||
QUnit.test('should work with a `comparator` argument', function(assert) {
|
QUnit.test('should work with a `comparator` argument', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }],
|
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }],
|
||||||
|
others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }],
|
||||||
actual = _.xorWith(objects, others, lodashStable.isEqual);
|
actual = _.xorWith(objects, others, lodashStable.isEqual);
|
||||||
|
|
||||||
assert.deepEqual(actual, [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]);
|
assert.deepEqual(actual, [objects[1], others[0]]);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user