From ede300622413a80356ff2c76bbe69d1128e49de8 Mon Sep 17 00:00:00 2001 From: Vasil Velichkov Date: Fri, 18 Feb 2022 11:12:24 +0200 Subject: [PATCH] Upgrade mocha package to its latest 5.* version The 5.* version is the latest one that supports node.js 4. Upgrade to latest 9.2.* version requires node.js 12.* Improve several unit tests as they started to fail because of https://github.com/mochajs/mocha/issues/3226 --- package.json | 2 +- test/smpp.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 23e918d..8efacaf 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "devDependencies": { "coveralls": "^2.11.9", "istanbul": "^0.4.3", - "mocha": "2.x" + "mocha": "^5.2.0" }, "dependencies": { "findhit-proxywrap": "^0.3.12", diff --git a/test/smpp.js b/test/smpp.js index bb46e7d..8ee2669 100644 --- a/test/smpp.js +++ b/test/smpp.js @@ -116,31 +116,46 @@ describe('Session', function() { describe('smpp.connect()', function() { it('should use 2775 or 3550 as default port', function() { var session = smpp.connect(); + session.on('error', function() {}); assert.equal(session.options.port, 2775); + session = smpp.connect({tls: true}); + session.on('error', function() {}); assert.equal(session.options.port, 3550); + session = smpp.connect('smpp://localhost'); + session.on('error', function() {}); assert.equal(session.options.port, 2775); + session = smpp.connect('ssmpp://localhost'); + session.on('error', function() {}); assert.equal(session.options.port, 3550); }); it('should be backward compatible', function() { var session = smpp.connect('127.0.0.1'); + session.on('error', function() {}); assert.equal(session.options.port, 2775); assert.equal(session.options.host, '127.0.0.1'); + session = smpp.connect('127.0.0.1', 1234); + session.on('error', function() {}); assert.equal(session.options.port, 1234); assert.equal(session.options.host, '127.0.0.1'); }); it('should properly parse connection url', function() { var session = smpp.connect('smpp://127.0.0.1:1234'); + session.on('error', function() {}); assert.equal(session.options.port, 1234); assert.equal(session.options.host, '127.0.0.1'); + session = smpp.connect('ssmpp://localhost'); + session.on('error', function() {}); assert(session.options.tls); + session = smpp.connect({ url: 'ssmpp://127.0.0.1:1234'}); + session.on('error', function() {}); assert(session.options.tls); assert.equal(session.options.port, 1234); assert.equal(session.options.host, '127.0.0.1');