test: replace function with arrow function

PR-URL: https://github.com/nodejs/node/pull/17305
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
kou-hin 2017-11-26 17:07:45 +09:00 committed by James M Snell
parent 156a38fef1
commit 54ff3b6b05

View File

@ -72,33 +72,33 @@ 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');
}));
}));
@ -106,7 +106,7 @@ server.on('listening', function() {
req.end();
}), 1);
setTimeout(common.mustCall(function() {
setTimeout(common.mustCall(() => {
const req = http.request({
port: server.address().port,
method: 'POST',
@ -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',
@ -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');
}));
}));