Merge pull request #1049 from abetomo/clean_code

Remove unnecessary code
This commit is contained in:
Keith Cirkel 2017-09-13 11:56:13 -07:00 committed by GitHub
commit 19e2c18cff
7 changed files with 2 additions and 22 deletions

View file

@ -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'
);

View file

@ -4,9 +4,7 @@
* MIT Licensed
*/
module.exports = function (chai, util) {
/*!
* Chai dependencies.
*/

View file

@ -10,7 +10,6 @@
var flag = require('./flag')
, getActual = require('./getActual')
, inspect = require('./inspect')
, objDisplay = require('./objDisplay');
/**

View file

@ -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);

View file

@ -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() {

View file

@ -810,5 +810,4 @@ describe('configuration', function () {
}
});
});
});

View file

@ -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'});