mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Remove unneeded value guards in tests.
This commit is contained in:
58
test/test.js
58
test/test.js
@@ -51,7 +51,6 @@
|
|||||||
freeze = Object.freeze,
|
freeze = Object.freeze,
|
||||||
getSymbols = Object.getOwnPropertySymbols,
|
getSymbols = Object.getOwnPropertySymbols,
|
||||||
identity = function(value) { return value; },
|
identity = function(value) { return value; },
|
||||||
JSON = root.JSON,
|
|
||||||
noop = function() {},
|
noop = function() {},
|
||||||
objToString = objectProto.toString,
|
objToString = objectProto.toString,
|
||||||
params = argv,
|
params = argv,
|
||||||
@@ -5614,20 +5613,15 @@
|
|||||||
QUnit.test('`_.' + methodName + '` should ' + (isStrict ? '' : 'not ') + 'throw strict mode errors', function(assert) {
|
QUnit.test('`_.' + methodName + '` should ' + (isStrict ? '' : 'not ') + 'throw strict mode errors', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
if (freeze) {
|
var object = freeze({ 'a': undefined, 'b': function() {} }),
|
||||||
var object = freeze({ 'a': undefined, 'b': function() {} }),
|
pass = !isStrict;
|
||||||
pass = !isStrict;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
func(object, isBindAll ? 'b' : { 'a': 1 });
|
func(object, isBindAll ? 'b' : { 'a': 1 });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
pass = !pass;
|
pass = !pass;
|
||||||
}
|
|
||||||
assert.ok(pass);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert);
|
|
||||||
}
|
}
|
||||||
|
assert.ok(pass);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -9752,17 +9746,13 @@
|
|||||||
}
|
}
|
||||||
Foo.prototype.constructor = null;
|
Foo.prototype.constructor = null;
|
||||||
|
|
||||||
var object2 = { 'a': 1 };
|
var object1 = create(null);
|
||||||
assert.strictEqual(_.isEqual(new Foo, object2), false);
|
object1.a = 1;
|
||||||
|
|
||||||
if (create) {
|
var object2 = { 'a': 1 };
|
||||||
var object1 = create(null);
|
|
||||||
object1.a = 1;
|
assert.strictEqual(_.isEqual(object1, object2), true);
|
||||||
assert.strictEqual(_.isEqual(object1, object2), true);
|
assert.strictEqual(_.isEqual(new Foo, object2), false);
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should return `false` for objects with custom `toString` methods', function(assert) {
|
QUnit.test('should return `false` for objects with custom `toString` methods', function(assert) {
|
||||||
@@ -11290,16 +11280,11 @@
|
|||||||
QUnit.test('should return `true` for objects with a `[[Prototype]]` of `null`', function(assert) {
|
QUnit.test('should return `true` for objects with a `[[Prototype]]` of `null`', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
if (create) {
|
var object = create(null);
|
||||||
var object = create(null);
|
assert.strictEqual(_.isPlainObject(object), true);
|
||||||
assert.strictEqual(_.isPlainObject(object), true);
|
|
||||||
|
|
||||||
object.constructor = objectProto.constructor;
|
object.constructor = objectProto.constructor;
|
||||||
assert.strictEqual(_.isPlainObject(object), true);
|
assert.strictEqual(_.isPlainObject(object), true);
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert, 2);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should return `true` for plain objects with a custom `valueOf` property', function(assert) {
|
QUnit.test('should return `true` for plain objects with a custom `valueOf` property', function(assert) {
|
||||||
@@ -11322,13 +11307,8 @@
|
|||||||
QUnit.test('should return `false` for objects with a custom `[[Prototype]]`', function(assert) {
|
QUnit.test('should return `false` for objects with a custom `[[Prototype]]`', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
if (create) {
|
var object = create({ 'a': 1 });
|
||||||
var object = create({ 'a': 1 });
|
assert.strictEqual(_.isPlainObject(object), false);
|
||||||
assert.strictEqual(_.isPlainObject(object), false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should return `false` for DOM elements', function(assert) {
|
QUnit.test('should return `false` for DOM elements', function(assert) {
|
||||||
|
|||||||
Reference in New Issue
Block a user