mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Cleanup tests.
This commit is contained in:
14
test/test.js
14
test/test.js
@@ -629,7 +629,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('supports loading ' + basename + ' with the Require.js "shim" configuration option', 1, function() {
|
test('supports loading ' + basename + ' with the Require.js "shim" configuration option', 1, function() {
|
||||||
if (amd && /requirejs/.test(ui.loaderPath)) {
|
if (amd && _.includes(ui.loaderPath, 'requirejs')) {
|
||||||
strictEqual((shimmedModule || {}).moduleName, 'shimmed');
|
strictEqual((shimmedModule || {}).moduleName, 'shimmed');
|
||||||
} else {
|
} else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -3707,7 +3707,7 @@
|
|||||||
|
|
||||||
test('should return `' + expected[1] + '` for empty collections', 1, function() {
|
test('should return `' + expected[1] + '` for empty collections', 1, function() {
|
||||||
var actual = [],
|
var actual = [],
|
||||||
emptyValues = /Index/.test(methodName) ? _.reject(empties, _.isPlainObject) : empties,
|
emptyValues = _.endsWith(methodName, 'Index') ? _.reject(empties, _.isPlainObject) : empties,
|
||||||
expecting = _.map(emptyValues, function() { return expected[1]; });
|
expecting = _.map(emptyValues, function() { return expected[1]; });
|
||||||
|
|
||||||
_.each(emptyValues, function(value) {
|
_.each(emptyValues, function(value) {
|
||||||
@@ -4812,7 +4812,7 @@
|
|||||||
values = [];
|
values = [];
|
||||||
|
|
||||||
func(array, function(value) { values.push(value); return false; });
|
func(array, function(value) { values.push(value); return false; });
|
||||||
deepEqual(values, [/Right/.test(methodName) ? 3 : 1]);
|
deepEqual(values, [_.endsWith(methodName, 'Right') ? 3 : 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` can exit early when iterating objects', 1, function() {
|
test('`_.' + methodName + '` can exit early when iterating objects', 1, function() {
|
||||||
@@ -5066,7 +5066,7 @@
|
|||||||
|
|
||||||
test('should work with ' + key + ' and return an unwrapped value when chaining', 1, function() {
|
test('should work with ' + key + ' and return an unwrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
strictEqual(_(collection).contains(3), true);
|
strictEqual(_(collection).includes(3), true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -7380,7 +7380,7 @@
|
|||||||
function(proto, key) {
|
function(proto, key) {
|
||||||
_.each([proto, _.create(proto)], function(object, index) {
|
_.each([proto, _.create(proto)], function(object, index) {
|
||||||
var actual = func(proto),
|
var actual = func(proto),
|
||||||
isErr = /Error/.test(key),
|
isErr = _.endsWith(key, 'Error'),
|
||||||
message = 'enumerable properties ' + (index ? 'inherited from' : 'on') + ' `' + key + '.prototype`',
|
message = 'enumerable properties ' + (index ? 'inherited from' : 'on') + ' `' + key + '.prototype`',
|
||||||
props = isErr ? ['constructor', 'toString'] : ['constructor'];
|
props = isErr ? ['constructor', 'toString'] : ['constructor'];
|
||||||
|
|
||||||
@@ -13703,7 +13703,7 @@
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var allMethods = _.reject(_.functions(_).sort(), function(methodName) {
|
var allMethods = _.reject(_.functions(_).sort(), function(methodName) {
|
||||||
return /^_/.test(methodName);
|
return _.startsWith(methodName, '_');
|
||||||
});
|
});
|
||||||
|
|
||||||
var returnArrays = [
|
var returnArrays = [
|
||||||
@@ -13914,7 +13914,7 @@
|
|||||||
message = '`_.' + methodName + '` handles `null` `thisArg` arguments';
|
message = '`_.' + methodName + '` handles `null` `thisArg` arguments';
|
||||||
|
|
||||||
if (func) {
|
if (func) {
|
||||||
if (/^reduce/.test(methodName) || methodName == 'transform') {
|
if (_.startsWith(methodName, 'reduce') || methodName == 'transform') {
|
||||||
func(array, callback, 0, null);
|
func(array, callback, 0, null);
|
||||||
} else if (_.includes(['assign', 'merge'], methodName)) {
|
} else if (_.includes(['assign', 'merge'], methodName)) {
|
||||||
func(array, array, callback, null);
|
func(array, array, callback, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user