mirror of
https://github.com/chaijs/chai
synced 2024-11-14 15:57:10 +00:00
Merge pull request #1049 from abetomo/clean_code
Remove unnecessary code
This commit is contained in:
commit
19e2c18cff
7 changed files with 2 additions and 22 deletions
|
@ -210,7 +210,6 @@ module.exports = function (chai, _) {
|
|||
flag(this, 'all', false);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* ### .all
|
||||
*
|
||||
|
@ -2271,7 +2270,6 @@ module.exports = function (chai, _) {
|
|||
if (keysType !== 'Array') {
|
||||
keys = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
} else {
|
||||
actual = _.getOwnEnumerableProperties(obj);
|
||||
|
||||
|
@ -3006,7 +3004,7 @@ module.exports = function (chai, _) {
|
|||
var contains = flag(this, 'contains');
|
||||
var ordered = flag(this, 'ordered');
|
||||
|
||||
var subject, failMsg, failNegateMsg, lengthCheck;
|
||||
var subject, failMsg, failNegateMsg;
|
||||
|
||||
if (contains) {
|
||||
subject = ordered ? 'an ordered superset' : 'a superset';
|
||||
|
@ -3078,7 +3076,6 @@ module.exports = function (chai, _) {
|
|||
|
||||
Assertion.addMethod('oneOf', oneOf);
|
||||
|
||||
|
||||
/**
|
||||
* ### .change(subject[, prop[, msg]])
|
||||
*
|
||||
|
@ -3726,7 +3723,7 @@ module.exports = function (chai, _) {
|
|||
var obj = flag(this, 'object');
|
||||
|
||||
this.assert(
|
||||
typeof obj === "number" && isFinite(obj)
|
||||
typeof obj === 'number' && isFinite(obj)
|
||||
, 'expected #{this} to be a finite number'
|
||||
, 'expected #{this} to not be a finite number'
|
||||
);
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
* MIT Licensed
|
||||
*/
|
||||
|
||||
|
||||
module.exports = function (chai, util) {
|
||||
|
||||
/*!
|
||||
* Chai dependencies.
|
||||
*/
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
var flag = require('./flag')
|
||||
, getActual = require('./getActual')
|
||||
, inspect = require('./inspect')
|
||||
, objDisplay = require('./objDisplay');
|
||||
|
||||
/**
|
||||
|
|
|
@ -196,7 +196,6 @@ function formatValue(ctx, value, recurseTimes) {
|
|||
return reduceToSingleString(output, base, braces);
|
||||
}
|
||||
|
||||
|
||||
function formatPrimitive(ctx, value) {
|
||||
switch (typeof value) {
|
||||
case 'undefined':
|
||||
|
@ -226,12 +225,10 @@ function formatPrimitive(ctx, value) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function formatError(value) {
|
||||
return '[' + Error.prototype.toString.call(value) + ']';
|
||||
}
|
||||
|
||||
|
||||
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
var output = [];
|
||||
for (var i = 0, l = value.length; i < l; ++i) {
|
||||
|
@ -334,12 +331,8 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|||
return name + ': ' + str;
|
||||
}
|
||||
|
||||
|
||||
function reduceToSingleString(output, base, braces) {
|
||||
var numLinesEst = 0;
|
||||
var length = output.reduce(function(prev, cur) {
|
||||
numLinesEst++;
|
||||
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
return prev + cur.length + 1;
|
||||
}, 0);
|
||||
|
||||
|
|
|
@ -130,7 +130,6 @@ describe('assert', function () {
|
|||
err(function () {
|
||||
assert.typeOf(5, 'string', 'blah');
|
||||
}, "blah: expected 5 to be a string");
|
||||
|
||||
});
|
||||
|
||||
it('notTypeOf', function () {
|
||||
|
@ -242,7 +241,6 @@ describe('assert', function () {
|
|||
assert.notInstanceOf(new Foo(), undefined);
|
||||
}, "The instanceof assertion needs a constructor but undefined was given.");
|
||||
|
||||
|
||||
if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
|
||||
err(function(){
|
||||
assert.notInstanceOf(new Foo(), Symbol());
|
||||
|
@ -1769,8 +1767,6 @@ describe('assert', function () {
|
|||
err(function () {
|
||||
assert.operator(w, '===', null);
|
||||
}, "expected undefined to be === null");
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('closeTo', function(){
|
||||
|
@ -2043,7 +2039,6 @@ describe('assert', function () {
|
|||
err(function() {
|
||||
assert.oneOf({ four: 4 }, [1, 2, { four: 4 }]);
|
||||
}, 'expected { four: 4 } to be one of [ 1, 2, { four: 4 } ]');
|
||||
|
||||
});
|
||||
|
||||
it('above', function() {
|
||||
|
|
|
@ -810,5 +810,4 @@ describe('configuration', function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -2054,7 +2054,6 @@ describe('should', function() {
|
|||
testSet.should.have.all.keys([{thisIs: 'anExampleObject'}, {doingThisBecauseOf: 'referential equality'}]);
|
||||
});
|
||||
|
||||
|
||||
// Using the same assertions as above but with `.deep` flag instead of using referential equality
|
||||
testSet.should.have.any.deep.keys({thisIs: 'anExampleObject'});
|
||||
testSet.should.have.any.deep.keys('thisDoesNotExist', 'thisToo', {thisIs: 'anExampleObject'});
|
||||
|
|
Loading…
Reference in a new issue