aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-http-pipe.js
diff options
context:
space:
mode:
authorAdrian Estrada <edsadr@gmail.com>2016-12-16 10:42:36 -0500
committerJames M Snell <jasnell@gmail.com>2016-12-22 22:22:07 -0800
commit9073fda52a7a133dcbe20bbc88def952a07164d3 (patch)
tree1bcf28b5b0d2ec3cd6f01370f967f43d281eb27f /test/parallel/test-cluster-http-pipe.js
parent80f19b043dda93135d69459def5944e60518c690 (diff)
downloadandroid-node-v8-9073fda52a7a133dcbe20bbc88def952a07164d3.tar.gz
android-node-v8-9073fda52a7a133dcbe20bbc88def952a07164d3.tar.bz2
android-node-v8-9073fda52a7a133dcbe20bbc88def952a07164d3.zip
test: refactor code in test-cluster-http-pipe
* use common.mustCall to control the functions execution automatically * use const instead of var * use assert.strictEqual instead assert.equal * use assert.ifError instead of throw error PR-URL: https://github.com/nodejs/node/pull/10297 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-cluster-http-pipe.js')
-rw-r--r--test/parallel/test-cluster-http-pipe.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js
index 0d6cb422be..6db581564a 100644
--- a/test/parallel/test-cluster-http-pipe.js
+++ b/test/parallel/test-cluster-http-pipe.js
@@ -13,28 +13,28 @@ if (common.isWindows) {
if (cluster.isMaster) {
common.refreshTmpDir();
- var worker = cluster.fork();
- worker.on('message', common.mustCall(function(msg) {
- assert.equal(msg, 'DONE');
+ const worker = cluster.fork();
+ worker.on('message', common.mustCall((msg) => {
+ assert.strictEqual(msg, 'DONE');
}));
- worker.on('exit', function() {
- process.exit();
- });
+ worker.on('exit', common.mustCall(() => {}));
return;
}
-http.createServer(function(req, res) {
- assert.equal(req.connection.remoteAddress, undefined);
- assert.equal(req.connection.localAddress, undefined); // TODO common.PIPE?
+http.createServer(common.mustCall((req, res) => {
+ assert.strictEqual(req.connection.remoteAddress, undefined);
+ assert.strictEqual(req.connection.localAddress, undefined);
+ // TODO common.PIPE?
+
res.writeHead(200);
res.end('OK');
-}).listen(common.PIPE, function() {
- http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
+})).listen(common.PIPE, common.mustCall(() => {
+ http.get({ socketPath: common.PIPE, path: '/' }, common.mustCall((res) => {
res.resume();
- res.on('end', function(err) {
- if (err) throw err;
+ res.on('end', common.mustCall((err) => {
+ assert.ifError(err);
process.send('DONE');
process.exit();
- });
- });
-});
+ }));
+ }));
+}));