summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJunichi Kajiwara <junichi.kajiwara@gmail.com>2017-11-26 18:01:02 +0900
committerJon Moss <me@jonathanmoss.me>2017-11-27 21:14:58 -0500
commita177708e338cc770f15405d5b706da094f101aa0 (patch)
tree46e264255e91a8f6768b2b56ece1c366d8284e07 /test
parent9e00d8ca5017a4080e678aed6cd262dc340a0e81 (diff)
downloadandroid-node-v8-a177708e338cc770f15405d5b706da094f101aa0.tar.gz
android-node-v8-a177708e338cc770f15405d5b706da094f101aa0.tar.bz2
android-node-v8-a177708e338cc770f15405d5b706da094f101aa0.zip
test: replace function with ES6 arrow function
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-http-pause.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/parallel/test-http-pause.js b/test/parallel/test-http-pause.js
index 8fe9424910..e2f462582f 100644
--- a/test/parallel/test-http-pause.js
+++ b/test/parallel/test-http-pause.js
@@ -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);
});