Permalink
Browse files

test: replace function with ES6 arrow function

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 gibfahn committed Nov 26, 2017
1 parent 3a0cb8f commit 4f3a16582742fb071d745b4928dc33319667522b
Showing with 9 additions and 9 deletions.
  1. +9 −9 test/parallel/test-http-pause.js
@@ -8,17 +8,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);
@@ -31,16 +31,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();
});
@@ -49,7 +49,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 4f3a165

Please sign in to comment.