Skip to content

Commit

Permalink
Slight cleanup to esline rules. Remove some overrides, refactor logic…
Browse files Browse the repository at this point in the history
… in _assertHeader function.
  • Loading branch information
mikelax committed Mar 30, 2016
1 parent 1849094 commit af3c013
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
10 changes: 2 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@
// disabled - disagree with airbnb
"func-names": [0],
"space-before-function-paren": [0],
"padded-blocks": [0],
"consistent-return": [0],

// Disabled but may want to refactor code eventually
"no-proto": [1],
"no-shadow": [1],
"no-use-before-define": [2, "nofunc"],

// IMHO, more sensible overrides to existing airbnb error definitions
"max-len": [2, 100, 4, {"ignoreComments": true, "ignoreUrls": true}],
"comma-dangle": [2, "never"],
"no-multi-spaces": [2, { "exceptions": { "VariableDeclarator": true, "Property": true } }],
"no-unused-expressions": [2, { "allowShortCircuit": true, "allowTernary": true }],
"no-use-before-define": [2, "nofunc"],
"no-param-reassign": [2, {"props": false}],
"no-cond-assign": [2, "except-parens"],
"no-return-assign": [2, "except-parens"]
"no-unused-expressions": [2, { "allowShortCircuit": true, "allowTernary": true }]
}
}
6 changes: 3 additions & 3 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ Test.prototype._assertHeader = function(header, res) {
var fieldExpected = header.value;

if (typeof actual === 'undefined') return new Error('expected "' + field + '" header field');
if (fieldExpected == actual) return; // eslint-disable-line eqeqeq
/* if ((actual instanceof Array && actual.toString() === fieldExpected) ||
// This check handles header values that may be a String or single element Array
if ((actual instanceof Array && actual.toString() === fieldExpected) ||
fieldExpected === actual) {
return;
} */
}
if (fieldExpected instanceof RegExp) {
if (!fieldExpected.test(actual)) {
return new Error('expected "' + field + '" matching ' +
Expand Down
4 changes: 3 additions & 1 deletion test/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// errors - disabled for chai test support
"no-unused-expressions": [0],
// allow function args for superagent
"no-unused-vars": [2, {"args": "none"}]
"no-unused-vars": [2, {"args": "none"}],
// allow updates to response for certain tests
"no-param-reassign": [2, {"props": false}]
}
}
4 changes: 1 addition & 3 deletions test/supertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,9 @@ describe('request(app)', function() {
});

describe('handling arbitrary expect functions', function() {

var app;
var get;

before(function() {
app = express();
app.get('/', function(req, res) {
Expand Down Expand Up @@ -703,7 +703,6 @@ describe('request(app)', function() {
});

describe('handling multiple assertions per field', function() {

it('should work', function(done) {
var app = express();
app.get('/', function(req, res) {
Expand Down Expand Up @@ -1003,7 +1002,6 @@ describe('assert ordering by call order', function() {
});

describe('request.get(url).query(vals) works as expected', function() {

it('normal single query string value works', function(done) {
var app = express();
app.get('/', function(req, res) {
Expand Down

0 comments on commit af3c013

Please sign in to comment.