mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Use nullish more in test labels.
This commit is contained in:
26
test/test.js
26
test/test.js
@@ -1137,7 +1137,7 @@
|
|||||||
deepEqual(_.assign({ 'a': 1, 'b': 2 }, expected), expected);
|
deepEqual(_.assign({ 'a': 1, 'b': 2 }, expected), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should assign source properties with `null` and `undefined` values', 1, function() {
|
test('should assign source properties with nullish values', 1, function() {
|
||||||
var expected = { 'a': null, 'b': undefined, 'c': null };
|
var expected = { 'a': null, 'b': undefined, 'c': null };
|
||||||
deepEqual(_.assign({ 'a': 1, 'b': 2 }, expected), expected);
|
deepEqual(_.assign({ 'a': 1, 'b': 2 }, expected), expected);
|
||||||
});
|
});
|
||||||
@@ -1394,7 +1394,7 @@
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should bind a function to `null` or `undefined`', 6, function() {
|
test('should bind a function to nullish values', 6, function() {
|
||||||
var bound = _.bind(fn, null),
|
var bound = _.bind(fn, null),
|
||||||
actual = bound('a');
|
actual = bound('a');
|
||||||
|
|
||||||
@@ -8831,7 +8831,7 @@
|
|||||||
deepEqual(func(array).sort(), ['0', '1', '2']);
|
deepEqual(func(array).sort(), ['0', '1', '2']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return an empty array for `null` or `undefined` values', 2, function() {
|
test('`_.' + methodName + '` should return an empty array for nullish values', 2, function() {
|
||||||
objectProto.a = 1;
|
objectProto.a = 1;
|
||||||
_.each([null, undefined], function(value) {
|
_.each([null, undefined], function(value) {
|
||||||
deepEqual(func(value), []);
|
deepEqual(func(value), []);
|
||||||
@@ -10934,7 +10934,7 @@
|
|||||||
deepEqual(_.omit(new Foo, 'a', 'c'), expected);
|
deepEqual(_.omit(new Foo, 'a', 'c'), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return an empty object when `object` is `null` or `undefined`', 2, function() {
|
test('should return an empty object when `object` is nullish', 2, function() {
|
||||||
objectProto.a = 1;
|
objectProto.a = 1;
|
||||||
_.each([null, undefined], function(value) {
|
_.each([null, undefined], function(value) {
|
||||||
deepEqual(_.omit(value, 'valueOf'), {});
|
deepEqual(_.omit(value, 'valueOf'), {});
|
||||||
@@ -11134,7 +11134,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return an empty string when provided `null`, `undefined`, or empty string and `chars`', 6, function() {
|
test('`_.' + methodName + '` should return an empty string when provided nullish or empty string values and `chars`', 6, function() {
|
||||||
_.each([null, '_-'], function(chars) {
|
_.each([null, '_-'], function(chars) {
|
||||||
strictEqual(func(null, 0, chars), '');
|
strictEqual(func(null, 0, chars), '');
|
||||||
strictEqual(func(undefined, 0, chars), '');
|
strictEqual(func(undefined, 0, chars), '');
|
||||||
@@ -11142,7 +11142,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should work with `null`, `undefined`, or empty string for `chars`', 3, function() {
|
test('`_.' + methodName + '` should work with nullish or empty string values for `chars`', 3, function() {
|
||||||
notStrictEqual(func('abc', 6, null), 'abc');
|
notStrictEqual(func('abc', 6, null), 'abc');
|
||||||
notStrictEqual(func('abc', 6, undefined), 'abc');
|
notStrictEqual(func('abc', 6, undefined), 'abc');
|
||||||
strictEqual(func('abc', 6, ''), 'abc');
|
strictEqual(func('abc', 6, ''), 'abc');
|
||||||
@@ -11669,7 +11669,7 @@
|
|||||||
deepEqual(_.pick(new Foo, 'a', 'c'), expected);
|
deepEqual(_.pick(new Foo, 'a', 'c'), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return an empty object when `object` is `null` or `undefined`', 2, function() {
|
test('should return an empty object when `object` is nullish', 2, function() {
|
||||||
_.each([null, undefined], function(value) {
|
_.each([null, undefined], function(value) {
|
||||||
deepEqual(_.pick(value, 'valueOf'), {});
|
deepEqual(_.pick(value, 'valueOf'), {});
|
||||||
});
|
});
|
||||||
@@ -14652,7 +14652,7 @@
|
|||||||
strictEqual(compiled(), '<<\n a \n>>');
|
strictEqual(compiled(), '<<\n a \n>>');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should resolve `null` and `undefined` values to an empty string', 3, function() {
|
test('should resolve nullish values to an empty string', 3, function() {
|
||||||
var compiled = _.template('<%= a %><%- a %>'),
|
var compiled = _.template('<%= a %><%- a %>'),
|
||||||
data = { 'a': null };
|
data = { 'a': null };
|
||||||
|
|
||||||
@@ -15419,7 +15419,7 @@
|
|||||||
this.c = 3;
|
this.c = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
test('should create an object with the same `[[Prototype]]` as `object` when `accumulator` is `null` or `undefined`', 4, function() {
|
test('should create an object with the same `[[Prototype]]` as `object` when `accumulator` is nullish', 4, function() {
|
||||||
var accumulators = [, null, undefined],
|
var accumulators = [, null, undefined],
|
||||||
expected = _.map(accumulators, _.constant(true)),
|
expected = _.map(accumulators, _.constant(true)),
|
||||||
object = new Foo;
|
object = new Foo;
|
||||||
@@ -15647,7 +15647,7 @@
|
|||||||
strictEqual(func(string, object), expected);
|
strictEqual(func(string, object), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return an empty string when provided `null`, `undefined`, or empty string and `chars`', 6, function() {
|
test('`_.' + methodName + '` should return an empty string when provided nullish or empty string values and `chars`', 6, function() {
|
||||||
_.each([null, '_-'], function(chars) {
|
_.each([null, '_-'], function(chars) {
|
||||||
strictEqual(func(null, chars), '');
|
strictEqual(func(null, chars), '');
|
||||||
strictEqual(func(undefined, chars), '');
|
strictEqual(func(undefined, chars), '');
|
||||||
@@ -15655,7 +15655,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should work with `null`, `undefined`, or empty string for `chars`', 3, function() {
|
test('`_.' + methodName + '` should work with nullish or empty string values for `chars`', 3, function() {
|
||||||
var string = whitespace + 'a b c' + whitespace,
|
var string = whitespace + 'a b c' + whitespace,
|
||||||
expected = (index == 2 ? whitespace : '') + 'a b c' + (index == 1 ? whitespace : '');
|
expected = (index == 2 ? whitespace : '') + 'a b c' + (index == 1 ? whitespace : '');
|
||||||
|
|
||||||
@@ -15853,7 +15853,7 @@
|
|||||||
deepEqual(_.uniq(largeArray), expected);
|
deepEqual(_.uniq(largeArray), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should work with large arrays of boolean, `NaN`, `null`, and `undefined` values', 1, function() {
|
test('should work with large arrays of boolean, `NaN`, and nullish values', 1, function() {
|
||||||
var largeArray = [],
|
var largeArray = [],
|
||||||
expected = [true, false, NaN, null, undefined],
|
expected = [true, false, NaN, null, undefined],
|
||||||
count = Math.ceil(LARGE_ARRAY_SIZE / expected.length);
|
count = Math.ceil(LARGE_ARRAY_SIZE / expected.length);
|
||||||
@@ -17057,7 +17057,7 @@
|
|||||||
_.each(stringMethods, function(methodName) {
|
_.each(stringMethods, function(methodName) {
|
||||||
var func = _[methodName];
|
var func = _[methodName];
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return an empty string when provided `null`, `undefined`, or empty string', 3, function() {
|
test('`_.' + methodName + '` should return an empty string when provided nullish or empty string values', 3, function() {
|
||||||
strictEqual(func(null), '');
|
strictEqual(func(null), '');
|
||||||
strictEqual(func(undefined), '');
|
strictEqual(func(undefined), '');
|
||||||
strictEqual(func(''), '');
|
strictEqual(func(''), '');
|
||||||
|
|||||||
Reference in New Issue
Block a user