Skip to content

Commit

Permalink
Merge pull request #208 from velichkov/mocha5
Browse files Browse the repository at this point in the history
Thanks for the effort upgrading dev dependencies
juliangut authored Mar 1, 2022
2 parents 3f40152 + ab8be95 commit de41366
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
},
"devDependencies": {
"coveralls": "^2.11.9",
"mocha": "2.x",
"mocha": "^5.2.0",
"nyc": "^12.0.2"
},
"dependencies": {
15 changes: 15 additions & 0 deletions test/smpp.js
Original file line number Diff line number Diff line change
@@ -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');

0 comments on commit de41366

Please sign in to comment.