Skip to content

Commit

Permalink
test: replace function with arrow function
Browse files Browse the repository at this point in the history
PR-URL: #17305
Reviewed-By: Yosuke Furukawa <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
kou-hin authored and MylesBorins committed Dec 12, 2017
1 parent d8e4d95 commit 3f4d0fc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/parallel/test-http.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,41 +72,41 @@ server.on('listening', function() {
Cookie: [ 'foo=bar', 'bar=baz', 'baz=quux' ]
},
agent: agent
}, common.mustCall(function(res) {
}, common.mustCall((res) => {
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
assert.deepStrictEqual(cookieHeaders,
['Cookie: foo=bar; bar=baz; baz=quux']);
assert.strictEqual(res.statusCode, 200);
let body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) { body += chunk; });
res.on('end', common.mustCall(function() {
res.on('data', (chunk) => { body += chunk; });
res.on('end', common.mustCall(() => {
assert.strictEqual(body, 'The path was /hello');
}));
}));

setTimeout(common.mustCall(function() {
setTimeout(common.mustCall(() => {
const req = http.request({
port: server.address().port,
method: 'PUT',
path: '/there',
agent: agent
}, common.mustCall(function(res) {
}, common.mustCall((res) => {
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
assert.deepStrictEqual(cookieHeaders, ['Cookie: node=awesome; ta=da']);
assert.strictEqual(res.statusCode, 200);
let body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) { body += chunk; });
res.on('end', common.mustCall(function() {
res.on('data', (chunk) => { body += chunk; });
res.on('end', common.mustCall(() => {
assert.strictEqual(body, 'The path was /there');
}));
}));
req.setHeader('Cookie', ['node=awesome', 'ta=da']);
req.end();
}), 1);

setTimeout(common.mustCall(function() {
setTimeout(common.mustCall(() => {
const req = http.request({
port: server.address().port,
method: 'POST',
Expand All @@ -115,7 +115,7 @@ server.on('listening', function() {
['Cookie', 'def=456'],
['Cookie', 'ghi=789'] ],
agent: agent
}, common.mustCall(function(res) {
}, common.mustCall((res) => {
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
assert.deepStrictEqual(cookieHeaders,
['Cookie: abc=123',
Expand All @@ -124,8 +124,8 @@ server.on('listening', function() {
assert.strictEqual(res.statusCode, 200);
let body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) { body += chunk; });
res.on('end', common.mustCall(function() {
res.on('data', (chunk) => { body += chunk; });
res.on('end', common.mustCall(() => {
assert.strictEqual(body, 'The path was /world');
}));
}));
Expand Down

0 comments on commit 3f4d0fc

Please sign in to comment.