Skip to content

Commit

Permalink
Merge pull request #1049 from abetomo/clean_code
Browse files Browse the repository at this point in the history
Remove unnecessary code
  • Loading branch information
keithamus committed Sep 13, 2017
2 parents 0d19b35 + 1c1b074 commit 19e2c18
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 22 deletions.
7 changes: 2 additions & 5 deletions lib/chai/core/assertions.js
Expand Up @@ -210,7 +210,6 @@ module.exports = function (chai, _) {
flag(this, 'all', false);
});


/**
* ### .all
*
Expand Down Expand Up @@ -2271,7 +2270,6 @@ module.exports = function (chai, _) {
if (keysType !== 'Array') {
keys = Array.prototype.slice.call(arguments);
}

} else {
actual = _.getOwnEnumerableProperties(obj);

Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -3078,7 +3076,6 @@ module.exports = function (chai, _) {

Assertion.addMethod('oneOf', oneOf);


/**
* ### .change(subject[, prop[, msg]])
*
Expand Down Expand Up @@ -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'
);
Expand Down
2 changes: 0 additions & 2 deletions lib/chai/interface/assert.js
Expand Up @@ -4,9 +4,7 @@
* MIT Licensed
*/


module.exports = function (chai, util) {

/*!
* Chai dependencies.
*/
Expand Down
1 change: 0 additions & 1 deletion lib/chai/utils/getMessage.js
Expand Up @@ -10,7 +10,6 @@

var flag = require('./flag')
, getActual = require('./getActual')
, inspect = require('./inspect')
, objDisplay = require('./objDisplay');

/**
Expand Down
7 changes: 0 additions & 7 deletions lib/chai/utils/inspect.js
Expand Up @@ -196,7 +196,6 @@ function formatValue(ctx, value, recurseTimes) {
return reduceToSingleString(output, base, braces);
}


function formatPrimitive(ctx, value) {
switch (typeof value) {
case 'undefined':
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 0 additions & 5 deletions test/assert.js
Expand Up @@ -130,7 +130,6 @@ describe('assert', function () {
err(function () {
assert.typeOf(5, 'string', 'blah');
}, "blah: expected 5 to be a string");

});

it('notTypeOf', function () {
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -1769,8 +1767,6 @@ describe('assert', function () {
err(function () {
assert.operator(w, '===', null);
}, "expected undefined to be === null");


});

it('closeTo', function(){
Expand Down Expand Up @@ -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() {
Expand Down
1 change: 0 additions & 1 deletion test/configuration.js
Expand Up @@ -810,5 +810,4 @@ describe('configuration', function () {
}
});
});

});
1 change: 0 additions & 1 deletion test/should.js
Expand Up @@ -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'});
Expand Down

0 comments on commit 19e2c18

Please sign in to comment.