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:
parent
156a38fef1
commit
54ff3b6b05
@ -72,33 +72,33 @@ server.on('listening', function() {
|
|||||||
Cookie: [ 'foo=bar', 'bar=baz', 'baz=quux' ]
|
Cookie: [ 'foo=bar', 'bar=baz', 'baz=quux' ]
|
||||||
},
|
},
|
||||||
agent: agent
|
agent: agent
|
||||||
}, common.mustCall(function(res) {
|
}, common.mustCall((res) => {
|
||||||
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
|
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
|
||||||
assert.deepStrictEqual(cookieHeaders,
|
assert.deepStrictEqual(cookieHeaders,
|
||||||
['Cookie: foo=bar; bar=baz; baz=quux']);
|
['Cookie: foo=bar; bar=baz; baz=quux']);
|
||||||
assert.strictEqual(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
let body = '';
|
let body = '';
|
||||||
res.setEncoding('utf8');
|
res.setEncoding('utf8');
|
||||||
res.on('data', function(chunk) { body += chunk; });
|
res.on('data', (chunk) => { body += chunk; });
|
||||||
res.on('end', common.mustCall(function() {
|
res.on('end', common.mustCall(() => {
|
||||||
assert.strictEqual(body, 'The path was /hello');
|
assert.strictEqual(body, 'The path was /hello');
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setTimeout(common.mustCall(function() {
|
setTimeout(common.mustCall(() => {
|
||||||
const req = http.request({
|
const req = http.request({
|
||||||
port: server.address().port,
|
port: server.address().port,
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
path: '/there',
|
path: '/there',
|
||||||
agent: agent
|
agent: agent
|
||||||
}, common.mustCall(function(res) {
|
}, common.mustCall((res) => {
|
||||||
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
|
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
|
||||||
assert.deepStrictEqual(cookieHeaders, ['Cookie: node=awesome; ta=da']);
|
assert.deepStrictEqual(cookieHeaders, ['Cookie: node=awesome; ta=da']);
|
||||||
assert.strictEqual(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
let body = '';
|
let body = '';
|
||||||
res.setEncoding('utf8');
|
res.setEncoding('utf8');
|
||||||
res.on('data', function(chunk) { body += chunk; });
|
res.on('data', (chunk) => { body += chunk; });
|
||||||
res.on('end', common.mustCall(function() {
|
res.on('end', common.mustCall(() => {
|
||||||
assert.strictEqual(body, 'The path was /there');
|
assert.strictEqual(body, 'The path was /there');
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
@ -106,7 +106,7 @@ server.on('listening', function() {
|
|||||||
req.end();
|
req.end();
|
||||||
}), 1);
|
}), 1);
|
||||||
|
|
||||||
setTimeout(common.mustCall(function() {
|
setTimeout(common.mustCall(() => {
|
||||||
const req = http.request({
|
const req = http.request({
|
||||||
port: server.address().port,
|
port: server.address().port,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -115,7 +115,7 @@ server.on('listening', function() {
|
|||||||
['Cookie', 'def=456'],
|
['Cookie', 'def=456'],
|
||||||
['Cookie', 'ghi=789'] ],
|
['Cookie', 'ghi=789'] ],
|
||||||
agent: agent
|
agent: agent
|
||||||
}, common.mustCall(function(res) {
|
}, common.mustCall((res) => {
|
||||||
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
|
const cookieHeaders = req._header.match(/^Cookie: .+$/img);
|
||||||
assert.deepStrictEqual(cookieHeaders,
|
assert.deepStrictEqual(cookieHeaders,
|
||||||
['Cookie: abc=123',
|
['Cookie: abc=123',
|
||||||
@ -124,8 +124,8 @@ server.on('listening', function() {
|
|||||||
assert.strictEqual(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
let body = '';
|
let body = '';
|
||||||
res.setEncoding('utf8');
|
res.setEncoding('utf8');
|
||||||
res.on('data', function(chunk) { body += chunk; });
|
res.on('data', (chunk) => { body += chunk; });
|
||||||
res.on('end', common.mustCall(function() {
|
res.on('end', common.mustCall(() => {
|
||||||
assert.strictEqual(body, 'The path was /world');
|
assert.strictEqual(body, 'The path was /world');
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user