Skip to content

Commit

Permalink
test: replace function with ES6 arrow function
Browse files Browse the repository at this point in the history
PR-URL: #17306
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
  • Loading branch information
kjunichi authored and MylesBorins committed Dec 12, 2017
1 parent 8e5b711 commit 71eb186
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/parallel/test-http-pause.js
Original file line number Diff line number Diff line change
@@ -29,17 +29,17 @@ let resultServer = '';
const expectedClient = 'Response Body from Server';
let resultClient = '';

const server = http.createServer(function(req, res) {
const server = http.createServer((req, res) => {
console.error('pause server request');
req.pause();
setTimeout(function() {
setTimeout(() => {
console.error('resume server request');
req.resume();
req.setEncoding('utf8');
req.on('data', function(chunk) {
req.on('data', (chunk) => {
resultServer += chunk;
});
req.on('end', function() {
req.on('end', () => {
console.error(resultServer);
res.writeHead(200);
res.end(expectedClient);
@@ -52,16 +52,16 @@ server.listen(0, function() {
port: this.address().port,
path: '/',
method: 'POST'
}, function(res) {
}, (res) => {
console.error('pause client response');
res.pause();
setTimeout(function() {
setTimeout(() => {
console.error('resume client response');
res.resume();
res.on('data', function(chunk) {
res.on('data', (chunk) => {
resultClient += chunk;
});
res.on('end', function() {
res.on('end', () => {
console.error(resultClient);
server.close();
});
@@ -70,7 +70,7 @@ server.listen(0, function() {
req.end(expectedServer);
});

process.on('exit', function() {
process.on('exit', () => {
assert.strictEqual(expectedServer, resultServer);
assert.strictEqual(expectedClient, resultClient);
});

0 comments on commit 71eb186

Please sign in to comment.