mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Use provide instead of pass to avoid confusing test wording.
This commit is contained in:
72
test/test.js
72
test/test.js
@@ -181,10 +181,10 @@
|
|||||||
/** Used as the property name for wrapper metadata */
|
/** Used as the property name for wrapper metadata */
|
||||||
var EXPANDO = '__lodash@' + _.VERSION + '__';
|
var EXPANDO = '__lodash@' + _.VERSION + '__';
|
||||||
|
|
||||||
/** Used to pass falsey values to methods */
|
/** Used to provide falsey values to methods */
|
||||||
var falsey = [, '', 0, false, NaN, null, undefined];
|
var falsey = [, '', 0, false, NaN, null, undefined];
|
||||||
|
|
||||||
/** Used to pass empty values to methods */
|
/** Used to provide empty values to methods */
|
||||||
var empties = [[], {}].concat(falsey.slice(1));
|
var empties = [[], {}].concat(falsey.slice(1));
|
||||||
|
|
||||||
/** Used to test error objects */
|
/** Used to test error objects */
|
||||||
@@ -1506,7 +1506,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should pass the correct `callback` arguments', 1, function() {
|
test('`_.' + methodName + '` should provide the correct `callback` arguments', 1, function() {
|
||||||
var argsList = [];
|
var argsList = [];
|
||||||
|
|
||||||
func(klass, function() {
|
func(klass, function() {
|
||||||
@@ -1803,7 +1803,7 @@
|
|||||||
deepEqual(actual, { '4': 1, '6': 2 });
|
deepEqual(actual, { '4': 1, '6': 2 });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.countBy(array, function() {
|
_.countBy(array, function() {
|
||||||
@@ -2131,10 +2131,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass any additional arguments after reaching arity target', 3, function() {
|
test('should provide additional arguments after reaching arity target', 3, function() {
|
||||||
var curried = _.curry(fn, 2);
|
var curried = _.curry(fn, 3);
|
||||||
deepEqual(curried(1)(2, 3, 4), [1, 2, 3, 4]);
|
deepEqual(curried(1)(2, 3, 4), [1, 2, 3, 4]);
|
||||||
deepEqual(curried(1, 2, 3, 4), [1, 2, 3, 4]);
|
deepEqual(curried(1, 2)(3, 4, 5), [1, 2, 3, 4, 5]);
|
||||||
deepEqual(curried(1, 2, 3, 4, 5, 6), [1, 2, 3, 4, 5, 6]);
|
deepEqual(curried(1, 2, 3, 4, 5, 6), [1, 2, 3, 4, 5, 6]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2227,10 +2227,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass any additional arguments after reaching arity target', 3, function() {
|
test('should provide additional arguments after reaching arity target', 3, function() {
|
||||||
var curried = _.curryRight(fn, 2);
|
var curried = _.curryRight(fn, 3);
|
||||||
deepEqual(curried(4)(1, 2, 3), [1, 2, 3, 4]);
|
deepEqual(curried(4)(1, 2, 3), [1, 2, 3, 4]);
|
||||||
deepEqual(curried(1, 2, 3, 4), [1, 2, 3, 4]);
|
deepEqual(curried(4, 5)(1, 2, 3), [1, 2, 3, 4, 5]);
|
||||||
deepEqual(curried(1, 2, 3, 4, 5, 6), [1, 2, 3, 4, 5, 6]);
|
deepEqual(curried(1, 2, 3, 4, 5, 6), [1, 2, 3, 4, 5, 6]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2848,7 +2848,7 @@
|
|||||||
deepEqual(actual, [1]);
|
deepEqual(actual, [1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.dropRightWhile(array, function() {
|
_.dropRightWhile(array, function() {
|
||||||
@@ -2910,7 +2910,7 @@
|
|||||||
deepEqual(actual, [3]);
|
deepEqual(actual, [3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.dropWhile(array, function() {
|
_.dropWhile(array, function() {
|
||||||
@@ -3467,7 +3467,7 @@
|
|||||||
deepEqual(actual, [2, 3]);
|
deepEqual(actual, [2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.takeRightWhile(array, function() {
|
_.takeRightWhile(array, function() {
|
||||||
@@ -3529,7 +3529,7 @@
|
|||||||
deepEqual(actual, [1, 2]);
|
deepEqual(actual, [1, 2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.takeWhile(array, function() {
|
_.takeWhile(array, function() {
|
||||||
@@ -3816,7 +3816,7 @@
|
|||||||
var array = [1, 2, 3],
|
var array = [1, 2, 3],
|
||||||
func = _[methodName];
|
func = _[methodName];
|
||||||
|
|
||||||
test('`_.' + methodName + '` should pass the correct `callback` arguments', 1, function() {
|
test('`_.' + methodName + '` should provide the correct `callback` arguments', 1, function() {
|
||||||
var args,
|
var args,
|
||||||
expected = [1, 0, array];
|
expected = [1, 0, array];
|
||||||
|
|
||||||
@@ -4081,7 +4081,7 @@
|
|||||||
var func = _[methodName],
|
var func = _[methodName],
|
||||||
isMerge = methodName == 'merge';
|
isMerge = methodName == 'merge';
|
||||||
|
|
||||||
test('`_.' + methodName + '` should pass the correct `callback` arguments', 3, function() {
|
test('`_.' + methodName + '` should provide the correct `callback` arguments', 3, function() {
|
||||||
var args,
|
var args,
|
||||||
object = { 'a': 1 },
|
object = { 'a': 1 },
|
||||||
source = { 'a': 2 };
|
source = { 'a': 2 };
|
||||||
@@ -4223,7 +4223,7 @@
|
|||||||
deepEqual(actual, { '4': [4], '6': [6, 6] });
|
deepEqual(actual, { '4': [4], '6': [6, 6] });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.groupBy(array, function() {
|
_.groupBy(array, function() {
|
||||||
@@ -5432,7 +5432,7 @@
|
|||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var argsList = [];
|
var argsList = [];
|
||||||
|
|
||||||
var object1 = {
|
var object1 = {
|
||||||
@@ -6515,7 +6515,7 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var array = [1, 2, 3];
|
var array = [1, 2, 3];
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.map(array, function() {
|
_.map(array, function() {
|
||||||
@@ -6610,7 +6610,7 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var object = { 'a': 1, 'b': 2, 'c': 3 };
|
var object = { 'a': 1, 'b': 2, 'c': 3 };
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.mapValues(object, function() {
|
_.mapValues(object, function() {
|
||||||
@@ -7149,7 +7149,7 @@
|
|||||||
strictEqual(actual, isMax ? 1 : 3);
|
strictEqual(actual, isMax ? 1 : 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should pass the correct `callback` arguments when iterating an array', 1, function() {
|
test('`_.' + methodName + '` should provide the correct `callback` arguments when iterating an array', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
func(array, function() {
|
func(array, function() {
|
||||||
@@ -7159,7 +7159,7 @@
|
|||||||
deepEqual(args, [1, 0, array]);
|
deepEqual(args, [1, 0, array]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should pass the correct `callback` arguments when iterating an object', 1, function() {
|
test('`_.' + methodName + '` should provide the correct `callback` arguments when iterating an object', 1, function() {
|
||||||
var args,
|
var args,
|
||||||
object = { 'a': 1, 'b': 2 },
|
object = { 'a': 1, 'b': 2 },
|
||||||
firstKey = _.first(_.keys(object));
|
firstKey = _.first(_.keys(object));
|
||||||
@@ -7493,7 +7493,7 @@
|
|||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args,
|
var args,
|
||||||
object = { 'a': 1, 'b': 2 },
|
object = { 'a': 1, 'b': 2 },
|
||||||
lastKey = _.keys(object).pop();
|
lastKey = _.keys(object).pop();
|
||||||
@@ -7950,7 +7950,7 @@
|
|||||||
deepEqual(actual, [[1, 1], [0]]);
|
deepEqual(actual, [[1, 1], [0]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.partition(array, function() {
|
_.partition(array, function() {
|
||||||
@@ -8050,7 +8050,7 @@
|
|||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args,
|
var args,
|
||||||
object = { 'a': 1, 'b': 2 },
|
object = { 'a': 1, 'b': 2 },
|
||||||
lastKey = _.keys(object).pop();
|
lastKey = _.keys(object).pop();
|
||||||
@@ -8358,7 +8358,7 @@
|
|||||||
strictEqual(_.reduce(array), 1);
|
strictEqual(_.reduce(array), 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments when iterating an array', 2, function() {
|
test('should provide the correct `callback` arguments when iterating an array', 2, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.reduce(array, function() {
|
_.reduce(array, function() {
|
||||||
@@ -8375,7 +8375,7 @@
|
|||||||
deepEqual(args, [1, 2, 1, array]);
|
deepEqual(args, [1, 2, 1, array]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments when iterating an object', 2, function() {
|
test('should provide the correct `callback` arguments when iterating an object', 2, function() {
|
||||||
var args,
|
var args,
|
||||||
object = { 'a': 1, 'b': 2 },
|
object = { 'a': 1, 'b': 2 },
|
||||||
firstKey = _.first(_.keys(object));
|
firstKey = _.first(_.keys(object));
|
||||||
@@ -8437,7 +8437,7 @@
|
|||||||
strictEqual(_.reduceRight(array), 3);
|
strictEqual(_.reduceRight(array), 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments when iterating an array', 2, function() {
|
test('should provide the correct `callback` arguments when iterating an array', 2, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.reduceRight(array, function() {
|
_.reduceRight(array, function() {
|
||||||
@@ -8454,7 +8454,7 @@
|
|||||||
deepEqual(args, [3, 2, 1, array]);
|
deepEqual(args, [3, 2, 1, array]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments when iterating an object', 2, function() {
|
test('should provide the correct `callback` arguments when iterating an object', 2, function() {
|
||||||
var args,
|
var args,
|
||||||
object = { 'a': 1, 'b': 2 },
|
object = { 'a': 1, 'b': 2 },
|
||||||
lastKey = _.last(_.keys(object));
|
lastKey = _.last(_.keys(object));
|
||||||
@@ -8633,7 +8633,7 @@
|
|||||||
deepEqual(actual, [1, 2]);
|
deepEqual(actual, [1, 2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args,
|
var args,
|
||||||
array = [1, 2, 3];
|
array = [1, 2, 3];
|
||||||
|
|
||||||
@@ -9214,7 +9214,7 @@
|
|||||||
deepEqual(actual, [1, 2, 3]);
|
deepEqual(actual, [1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.sortBy(objects, function() {
|
_.sortBy(objects, function() {
|
||||||
@@ -9339,7 +9339,7 @@
|
|||||||
func = _[methodName],
|
func = _[methodName],
|
||||||
objects = [{ 'x': 30 }, { 'x': 50 }];
|
objects = [{ 'x': 30 }, { 'x': 50 }];
|
||||||
|
|
||||||
test('`_.' + methodName + '` should pass the correct `callback` arguments', 1, function() {
|
test('`_.' + methodName + '` should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
func(array, 40, function() {
|
func(array, 40, function() {
|
||||||
@@ -10373,7 +10373,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `callback` arguments', 1, function() {
|
test('should provide the correct `callback` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.times(1, function() {
|
_.times(1, function() {
|
||||||
@@ -10467,7 +10467,7 @@
|
|||||||
'object': { 'a': 1, 'b': 2, 'c': 3 }
|
'object': { 'a': 1, 'b': 2, 'c': 3 }
|
||||||
},
|
},
|
||||||
function(object, key) {
|
function(object, key) {
|
||||||
test('should pass the correct `callback` arguments when transforming an ' + key, 2, function() {
|
test('should provide the correct `callback` arguments when transforming an ' + key, 2, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
_.transform(object, function() {
|
_.transform(object, function() {
|
||||||
@@ -10860,7 +10860,7 @@
|
|||||||
strictEqual(p('fred, barney, & pebbles'), '<p>fred, barney, & pebbles</p>');
|
strictEqual(p('fred, barney, & pebbles'), '<p>fred, barney, & pebbles</p>');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should pass the correct `wrapper` arguments', 1, function() {
|
test('should provide the correct `wrapper` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
var wrapped = _.wrap(_.noop, function() {
|
var wrapped = _.wrap(_.noop, function() {
|
||||||
@@ -11118,7 +11118,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should stringify the wrapped value when passed to `JSON.stringify`', 1, function() {
|
test('should stringify the wrapped value when used by `JSON.stringify`', 1, function() {
|
||||||
if (!isNpm && JSON) {
|
if (!isNpm && JSON) {
|
||||||
var wrapped = _([1, 2, 3]);
|
var wrapped = _([1, 2, 3]);
|
||||||
strictEqual(JSON.stringify(wrapped), '[1,2,3]');
|
strictEqual(JSON.stringify(wrapped), '[1,2,3]');
|
||||||
|
|||||||
Reference in New Issue
Block a user