mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Cleanup tests.
This commit is contained in:
15
test/test.js
15
test/test.js
@@ -1864,6 +1864,7 @@
|
|||||||
test('`_.' + methodName + '` should not error on DOM elements', 1, function() {
|
test('`_.' + methodName + '` should not error on DOM elements', 1, function() {
|
||||||
if (document) {
|
if (document) {
|
||||||
var element = document.createElement('div');
|
var element = document.createElement('div');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
deepEqual(func(element), {});
|
deepEqual(func(element), {});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@@ -2291,6 +2292,7 @@
|
|||||||
|
|
||||||
test('should not error when `func` is nullish and a `thisArg` is provided', 2, function() {
|
test('should not error when `func` is nullish and a `thisArg` is provided', 2, function() {
|
||||||
var object = {};
|
var object = {};
|
||||||
|
|
||||||
_.each([null, undefined], function(value) {
|
_.each([null, undefined], function(value) {
|
||||||
try {
|
try {
|
||||||
var callback = _.callback(value, {});
|
var callback = _.callback(value, {});
|
||||||
@@ -7858,6 +7860,7 @@
|
|||||||
_.each(funcs, function(methodName) {
|
_.each(funcs, function(methodName) {
|
||||||
if (xml) {
|
if (xml) {
|
||||||
var pass = true;
|
var pass = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_[methodName](xml);
|
_[methodName](xml);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@@ -8654,7 +8657,7 @@
|
|||||||
raises(function() { _.memoize(_.noop, {}); }, TypeError);
|
raises(function() { _.memoize(_.noop, {}); }, TypeError);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should not throw a TypeError if `resolve` is falsey', function() {
|
test('should not error if `resolve` is falsey', function() {
|
||||||
var expected = _.map(falsey, _.constant(true));
|
var expected = _.map(falsey, _.constant(true));
|
||||||
|
|
||||||
var actual = _.map(falsey, function(value, index) {
|
var actual = _.map(falsey, function(value, index) {
|
||||||
@@ -9595,7 +9598,7 @@
|
|||||||
QUnit.module('lodash.pairs');
|
QUnit.module('lodash.pairs');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('should create a two dimensional array of an object\'s key-value pairs', 1, function() {
|
test('should create a two dimensional array of key-value pairs', 1, function() {
|
||||||
var object = { 'a': 1, 'b': 2 };
|
var object = { 'a': 1, 'b': 2 };
|
||||||
deepEqual(_.pairs(object), [['a', 1], ['b', 2]]);
|
deepEqual(_.pairs(object), [['a', 1], ['b', 2]]);
|
||||||
});
|
});
|
||||||
@@ -11792,7 +11795,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should not error on nullish elements', 1, function() {
|
test('should not error on nullish elements', 1, function() {
|
||||||
var actual = _.sortByAll(objects.concat(undefined), ['a', 'b']);
|
try {
|
||||||
|
var actual = _.sortByAll(objects.concat(undefined), ['a', 'b']);
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
deepEqual(actual, [objects[2], objects[0], objects[3], objects[1], undefined]);
|
deepEqual(actual, [objects[2], objects[0], objects[3], objects[1], undefined]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -14629,13 +14635,14 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should throw a TypeError for falsey arguments', 22, function() {
|
test('should throw an error for falsey arguments', 22, function() {
|
||||||
_.each(rejectFalsey, function(methodName) {
|
_.each(rejectFalsey, function(methodName) {
|
||||||
var expected = _.map(falsey, _.constant(true)),
|
var expected = _.map(falsey, _.constant(true)),
|
||||||
func = _[methodName];
|
func = _[methodName];
|
||||||
|
|
||||||
var actual = _.map(falsey, function(value, index) {
|
var actual = _.map(falsey, function(value, index) {
|
||||||
var pass = !index && /^(?:backflow|compose|flow(Right)?)$/.test(methodName);
|
var pass = !index && /^(?:backflow|compose|flow(Right)?)$/.test(methodName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
index ? func(value) : func();
|
index ? func(value) : func();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user