Skip to content

Commit

Permalink
Upgrade mocha package to its latest 5.* version
Browse files Browse the repository at this point in the history
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
mochajs/mocha#3226
  • Loading branch information
velichkov committed Feb 18, 2022
1 parent 3b6dca9 commit ede3006
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions test/smpp.js
Expand Up @@ -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');
Expand Down

0 comments on commit ede3006

Please sign in to comment.