mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Cleanup deep path tests.
This commit is contained in:
100
test/test.js
100
test/test.js
@@ -15315,7 +15315,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('should return `undefined` with deep paths when `object` is nullish', function(assert) {
|
||||
QUnit.test('should return `undefined` for deep paths when `object` is nullish', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var values = [, null, undefined],
|
||||
@@ -15469,7 +15469,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('should return `undefined` with deep paths when `object` is nullish', function(assert) {
|
||||
QUnit.test('should return `undefined` for deep paths when `object` is nullish', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var values = [, null, undefined],
|
||||
@@ -16343,15 +16343,34 @@
|
||||
|
||||
(function() {
|
||||
var args = toArgs(['a', 'c']),
|
||||
object = { 'a': 1, 'b': 2, 'c': 3, 'd': 4 };
|
||||
object = { 'a': 1, 'b': 2, 'c': 3, 'd': 4 },
|
||||
nested = { 'a': 1, 'b': { 'c': 2, 'd': 3 } };
|
||||
|
||||
QUnit.test('should flatten `props`', function(assert) {
|
||||
QUnit.test('should flatten `paths`', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
assert.deepEqual(_.omit(object, 'a', 'c'), { 'b': 2, 'd': 4 });
|
||||
assert.deepEqual(_.omit(object, ['a', 'd'], 'c'), { 'b': 2 });
|
||||
});
|
||||
|
||||
QUnit.test('should support deep paths', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.omit(nested, 'b.c'), { 'a': 1, 'b': { 'd': 3} });
|
||||
});
|
||||
|
||||
QUnit.test('should coerce property names to strings', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.omit({ '0': 'a' }, 0), {});
|
||||
});
|
||||
|
||||
QUnit.test('should work with `arguments` objects as secondary arguments', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.omit(object, args), { 'b': 2, 'd': 4 });
|
||||
});
|
||||
|
||||
QUnit.test('should work with a primitive `object`', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
@@ -16374,24 +16393,6 @@
|
||||
assert.deepEqual(actual, {});
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('should work with `arguments` objects as secondary arguments', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.omit(object, args), { 'b': 2, 'd': 4 });
|
||||
});
|
||||
|
||||
QUnit.test('should coerce property names to strings', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.omit({ '0': 'a' }, 0), {});
|
||||
});
|
||||
|
||||
QUnit.test('should work with deep properties', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.omit({ 'a': 1, 'b': { 'c': 2 } }, 'b.c'), { 'a': 1, 'b': {} });
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -16463,7 +16464,7 @@
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should include symbol properties', function(assert) {
|
||||
QUnit.test('`_.' + methodName + '` should include symbols', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
function Foo() {
|
||||
@@ -16486,7 +16487,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should create an object with omitted symbol properties', function(assert) {
|
||||
QUnit.test('`_.' + methodName + '` should create an object with omitted symbols', function(assert) {
|
||||
assert.expect(6);
|
||||
|
||||
function Foo() {
|
||||
@@ -17580,15 +17581,34 @@
|
||||
|
||||
(function() {
|
||||
var args = toArgs(['a', 'c']),
|
||||
object = { 'a': 1, 'b': 2, 'c': 3, 'd': 4 };
|
||||
object = { 'a': 1, 'b': 2, 'c': 3, 'd': 4 },
|
||||
nested = { 'a': 1, 'b': { 'c': 2, 'd': 3 } };
|
||||
|
||||
QUnit.test('should flatten `props`', function(assert) {
|
||||
QUnit.test('should flatten `paths`', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
assert.deepEqual(_.pick(object, 'a', 'c'), { 'a': 1, 'c': 3 });
|
||||
assert.deepEqual(_.pick(object, ['a', 'd'], 'c'), { 'a': 1, 'c': 3, 'd': 4 });
|
||||
});
|
||||
|
||||
QUnit.test('should support deep paths', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.pick(nested, 'b.c'), { 'b': { 'c': 2 } });
|
||||
});
|
||||
|
||||
QUnit.test('should coerce property names to strings', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.pick({ '0': 'a', '1': 'b' }, 0), { '0': 'a' });
|
||||
});
|
||||
|
||||
QUnit.test('should work with `arguments` objects as secondary arguments', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.pick(object, args), { 'a': 1, 'c': 3 });
|
||||
});
|
||||
|
||||
QUnit.test('should work with a primitive `object`', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
@@ -17602,24 +17622,6 @@
|
||||
assert.deepEqual(_.pick(value, 'valueOf'), {});
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('should work with `arguments` objects as secondary arguments', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.pick(object, args), { 'a': 1, 'c': 3 });
|
||||
});
|
||||
|
||||
QUnit.test('should coerce property names to strings', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.pick({ '0': 'a', '1': 'b' }, 0), { '0': 'a' });
|
||||
});
|
||||
|
||||
QUnit.test('should work with deep properties', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(_.pick({ 'a': 1, 'b': { 'c': 2 } }, 'b.c'), { 'b': { 'c': 2 } });
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -17692,7 +17694,7 @@
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should pick symbol properties', function(assert) {
|
||||
QUnit.test('`_.' + methodName + '` should pick symbols', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
function Foo() {
|
||||
@@ -17835,7 +17837,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('should return `undefined` with deep paths when `object` is nullish', function(assert) {
|
||||
QUnit.test('should return `undefined` for deep paths when `object` is nullish', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var values = [, null, undefined],
|
||||
@@ -17979,7 +17981,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('should return `undefined` with deep paths when `object` is nullish', function(assert) {
|
||||
QUnit.test('should return `undefined` for deep paths when `object` is nullish', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var values = [, null, undefined],
|
||||
@@ -18232,7 +18234,7 @@
|
||||
assert.deepEqual(actual, [[-2], [-2], [-1], [-1]]);
|
||||
});
|
||||
|
||||
QUnit.test('should work with deep paths', function(assert) {
|
||||
QUnit.test('should support deep paths', function(assert) {
|
||||
assert.expect(3);
|
||||
|
||||
var array = [];
|
||||
@@ -19256,7 +19258,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should return `undefined` with deep paths when `object` is nullish', function(assert) {
|
||||
QUnit.test('`_.' + methodName + '` should return `undefined` for deep paths when `object` is nullish', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var values = [null, undefined],
|
||||
|
||||
Reference in New Issue
Block a user