Skip to content

Commit

Permalink
style: fix failing check-style (#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
William Blankenship authored and hekike committed Jun 5, 2018
1 parent 4537514 commit 39bb37e
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 113 deletions.
18 changes: 12 additions & 6 deletions test/plugins/jsonBodyParser.test.js
Expand Up @@ -257,9 +257,12 @@ describe('JSON body parser', function() {
'\r\n' +
'{"foo":"bar"}';

var client = net.connect({ host: '127.0.0.1', port: PORT }, function() {
client.write(request);
});
var client = net.connect(
{ host: '127.0.0.1', port: PORT },
function() {
client.write(request);
}
);
client.once('data', function(data) {
client.end();
});
Expand Down Expand Up @@ -290,9 +293,12 @@ describe('JSON body parser', function() {
'\r\n' +
'{"foo":"bar"}';

var client = net.connect({ host: '127.0.0.1', port: PORT }, function() {
client.write(request);
});
var client = net.connect(
{ host: '127.0.0.1', port: PORT },
function() {
client.write(request);
}
);

client.once('data', function(data) {
client.end();
Expand Down
34 changes: 23 additions & 11 deletions test/plugins/static.test.js
Expand Up @@ -321,11 +321,17 @@ describe('static resource plugin', function() {
});
});

socket.connect({ host: '127.0.0.1', port: PORT }, function() {
socket.write(RAW_REQUEST, 'utf-8', function(err2, data) {
assert.ifError(err2);
});
});
socket.connect(
{ host: '127.0.0.1', port: PORT },
function() {
socket.write(RAW_REQUEST, 'utf-8', function(
err2,
data
) {
assert.ifError(err2);
});
}
);
});
}
);
Expand Down Expand Up @@ -363,12 +369,18 @@ describe('static resource plugin', function() {
});

var socket = new net.Socket();
socket.connect({ host: '127.0.0.1', port: PORT }, function() {
socket.write(RAW_REQUEST, 'utf-8', function(err2, data) {
assert.ifError(err2);
socket.end();
});
});
socket.connect(
{ host: '127.0.0.1', port: PORT },
function() {
socket.write(RAW_REQUEST, 'utf-8', function(
err2,
data
) {
assert.ifError(err2);
socket.end();
});
}
);
});
}
);
Expand Down
166 changes: 75 additions & 91 deletions test/server.test.js
Expand Up @@ -396,15 +396,13 @@ test('PATCH ok', function(t) {
method: 'PATCH',
agent: false
};
http
.request(opts, function(res) {
t.equal(res.statusCode, 200);
res.on('end', function() {
t.end();
});
res.resume();
})
.end();
http.request(opts, function(res) {
t.equal(res.statusCode, 200);
res.on('end', function() {
t.end();
});
res.resume();
}).end();
});

test('HEAD ok', function(t) {
Expand All @@ -423,17 +421,15 @@ test('HEAD ok', function(t) {
method: 'HEAD',
agent: false
};
http
.request(opts, function(res) {
t.equal(res.statusCode, 200);
res.on('data', function(chunk) {
t.fail('Data was sent on HEAD');
});
res.on('end', function() {
t.end();
});
})
.end();
http.request(opts, function(res) {
t.equal(res.statusCode, 200);
res.on('data', function(chunk) {
t.fail('Data was sent on HEAD');
});
res.on('end', function() {
t.end();
});
}).end();
});

test('DELETE ok', function(t) {
Expand All @@ -452,15 +448,13 @@ test('DELETE ok', function(t) {
method: 'DELETE',
agent: false
};
http
.request(opts, function(res) {
t.equal(res.statusCode, 204);
res.on('data', function(chunk) {
t.fail('Data was sent on 204');
});
t.end();
})
.end();
http.request(opts, function(res) {
t.equal(res.statusCode, 204);
res.on('data', function(chunk) {
t.fail('Data was sent on 204');
});
t.end();
}).end();
});

test('OPTIONS', function(t) {
Expand All @@ -480,12 +474,10 @@ test('OPTIONS', function(t) {
method: 'OPTIONS',
agent: false
};
http
.request(opts, function(res) {
t.equal(res.statusCode, 200);
t.end();
})
.end();
http.request(opts, function(res) {
t.equal(res.statusCode, 200);
t.end();
}).end();
});

test('RegExp ok', function(t) {
Expand Down Expand Up @@ -544,20 +536,18 @@ test('GH-56 streaming with filed (download)', function(t) {
method: 'GET',
agent: false
};
http
.request(opts, function(res) {
t.equal(res.statusCode, 200);
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
t.ok(body.length > 0);
t.end();
});
})
.end();
http.request(opts, function(res) {
t.equal(res.statusCode, 200);
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
t.ok(body.length > 0);
t.end();
});
}).end();
});

test('GH-63 res.send 204 is sending a body', function(t) {
Expand All @@ -577,20 +567,18 @@ test('GH-63 res.send 204 is sending a body', function(t) {
}
};

http
.request(opts, function(res) {
t.equal(res.statusCode, 204);
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
t.notOk(body);
t.end();
});
})
.end();
http.request(opts, function(res) {
t.equal(res.statusCode, 204);
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
t.notOk(body);
t.end();
});
}).end();
});

test('GH-64 prerouting chain', function(t) {
Expand All @@ -615,20 +603,18 @@ test('GH-64 prerouting chain', function(t) {
accept: 'text/plain'
}
};
http
.request(opts, function(res) {
t.equal(res.statusCode, 200);
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
t.equal(body, '"mark"');
t.end();
});
})
.end();
http.request(opts, function(res) {
t.equal(res.statusCode, 200);
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
t.equal(body, '"mark"');
t.end();
});
}).end();
});

test('GH-64 prerouting chain with error', function(t) {
Expand Down Expand Up @@ -723,20 +709,18 @@ test('GH-180 can parse DELETE body', function(t) {
'transfer-encoding': 'chunked'
}
};
http
.request(opts, function(res) {
t.equal(res.statusCode, 200);
res.setEncoding('utf8');
res.body = '';
res.on('data', function(chunk) {
res.body += chunk;
});
res.on('end', function() {
t.equal(res.body, '{"param1":1234}');
t.end();
});
})
.end('{"param1": 1234}');
http.request(opts, function(res) {
t.equal(res.statusCode, 200);
res.setEncoding('utf8');
res.body = '';
res.on('data', function(chunk) {
res.body += chunk;
});
res.on('end', function() {
t.equal(res.body, '{"param1":1234}');
t.end();
});
}).end('{"param1": 1234}');
});

test('returning error from a handler (with domains)', function(t) {
Expand Down
9 changes: 6 additions & 3 deletions test/serverHttp2.test.js
Expand Up @@ -53,9 +53,12 @@ before(function(cb) {
});
SERVER.listen(PORT, '127.0.0.1', function() {
PORT = SERVER.address().port;
CLIENT = http2.connect('https://127.0.0.1:' + PORT, {
rejectUnauthorized: false
});
CLIENT = http2.connect(
'https://127.0.0.1:' + PORT,
{
rejectUnauthorized: false
}
);

cb();
});
Expand Down
14 changes: 12 additions & 2 deletions test/upgrade.test.js
Expand Up @@ -304,7 +304,12 @@ test('GET with upgrade headers', function(t) {
t.equal(typeof socket, 'object');
t.ok(Buffer.isBuffer(head), 'head is Buffer');
t.doesNotThrow(function() {
var shed = WATERSHED.connect(res, socket, head, wskey);
var shed = WATERSHED.connect(
res,
socket,
head,
wskey
);
SHEDLIST.push(shed);
shed.end('ok, done');
shed.on('error', function(err3) {
Expand Down Expand Up @@ -375,7 +380,12 @@ test('GET with some websocket traffic', function(t) {
t.equal(typeof socket, 'object');
t.ok(Buffer.isBuffer(head), 'head is Buffer');
t.doesNotThrow(function() {
var shed = WATERSHED.connect(res, socket, head, wskey);
var shed = WATERSHED.connect(
res,
socket,
head,
wskey
);
SHEDLIST.push(shed);
shed.on('error', function(err3) {
t.ifError(err3);
Expand Down

0 comments on commit 39bb37e

Please sign in to comment.