Description: Fix for Node.js 10
Author: Xavier Guimard <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2019-04-18

--- a/test/node/agency.js
+++ b/test/node/agency.js
@@ -4,8 +4,10 @@
   , assert = require('assert')
   , should = require('should');
 
-app.use(express.cookieParser());
-app.use(express.session({ secret: 'secret' }));
+var cookieParser = require('cookie-parser');
+var session = require('express-session');
+app.use(cookieParser());
+app.use(session({ secret: 'secret' }));
 
 app.post('/signin', function(req, res) {
   req.session.user = 'hunter@hunterloftis.com';
--- a/test/node/flags.js
+++ b/test/node/flags.js
@@ -29,7 +29,7 @@
   res.send(204);
 });
 
-app.listen(3004);
+var s = app.listen(3004);
 
 describe('flags', function(){
 
@@ -116,4 +116,10 @@
       });
     })
   })
-})
\ No newline at end of file
+  describe('end test', function(){
+    it('should stop server', function(done){
+      s.close();
+      done();
+    });
+  });
+})
--- a/test/node/image.js
+++ b/test/node/image.js
@@ -19,7 +19,7 @@
     res.end(img, 'binary');
   });
 
-  app.listen(3011);
+  var s = app.listen(3011);
 
   describe('image/png', function(){
     it('should parse the body', function(done){
@@ -31,4 +31,10 @@
       });
     });
   });
+  describe('end test', function(){
+    it('should stop server', function(done){
+      s.close();
+      done();
+    });
+  });
 });
--- a/test/node/inflate.js
+++ b/test/node/inflate.js
@@ -15,7 +15,7 @@
   var app = express()
     , subject = 'some long long long long string';
 
-  app.listen(3080);
+  s = app.listen(3080);
 
   app.get('/binary', function(req, res){
     zlib.deflate(subject, function (err, buf){
@@ -37,7 +37,7 @@
       request
         .get('http://localhost:3080')
         .end(function(res){
-          res.should.have.status(200);
+          res.status.should.eql(200);
           res.text.should.equal(subject);
           res.headers['content-length'].should.be.below(subject.length);
           done();
@@ -49,7 +49,7 @@
         request
           .get('http://localhost:3080/binary')
           .end(function(res){
-            res.should.have.status(200);
+            res.status.should.eql(200);
             res.headers['content-length'].should.be.below(subject.length);
 
             res.on('data', function(chunk){
@@ -61,4 +61,10 @@
       })
     })
   });
+  describe('end test', function(){
+    it('should stop server', function(done){
+      s.close();
+      done();
+    });
+  });
 }
--- a/test/node/pipe.js
+++ b/test/node/pipe.js
@@ -4,7 +4,8 @@
   , app = express()
   , fs = require('fs');
 
-app.use(express.bodyParser());
+var bodyParser = require('body-parser')
+app.use(bodyParser.json());
 
 app.post('/', function(req, res){
   res.send(req.body);
--- a/test/node/redirects-other-host.js
+++ b/test/node/redirects-other-host.js
@@ -9,7 +9,7 @@
   res.redirect('https://github.com/');
 });
 
-app.listen(3210);
+var s = app.listen(3210);
 
 describe('request', function(){
   describe('on redirect', function(){
@@ -24,4 +24,10 @@
         });
     })
   });
-});
\ No newline at end of file
+});
+describe('end test', function(){
+  it('should stop server', function(done){
+    s.close();
+    done();
+  });
+});
--- a/test/node/response-readable-stream.js
+++ b/test/node/response-readable-stream.js
@@ -8,7 +8,7 @@
   fs.createReadStream('test/node/fixtures/user.json').pipe(res);
 });
 
-app.listen(3025);
+var s = app.listen(3025);
 
 describe('response', function(){
     it('should act as a readable stream', function(done){
@@ -39,3 +39,9 @@
       });
     });
 });
+describe('end test', function(){
+  it('should stop server', function(done){
+    s.close();
+    done();
+  });
+});
--- a/test/node/timeout.js
+++ b/test/node/timeout.js
@@ -11,7 +11,7 @@
   }, ms);
 });
 
-app.listen(3009);
+var s = app.listen(3009);
 
 describe('.timeout(ms)', function(){
   describe('when timeout is exceeded', function(done){
@@ -26,4 +26,10 @@
       });
     })
   })
-})
\ No newline at end of file
+})
+describe('end test', function(){
+  it('should stop server', function(done){
+    s.close();
+    done();
+  });
+});
--- a/test/server.js
+++ b/test/server.js
@@ -15,8 +15,10 @@
   req.pipe(res);
 });
 
-app.use(express.bodyParser());
-app.use(express.cookieParser());
+var cookieParser = require('cookie-parser')
+var bodyParser = require('body-parser')
+app.use(bodyParser.json());
+app.use(cookieParser());
 
 app.use(function(req, res, next){
   res.cookie('name', 'tobi');
@@ -132,7 +134,8 @@
   res.send(req.cookies.name);
 });
 
-app.use(express.static(__dirname + '/../'));
+var serveStatic = require('serve-static')
+app.use(serveStatic(__dirname + '/../'));
 
 var server = app.listen(process.env.ZUUL_PORT, function() {
   //console.log('Test server listening on port %d', server.address().port);
