Allow to specify server url without explicit port number

This commit is contained in:
Ivan Tivonenko
2015-08-21 05:28:22 +03:00
parent e3b688d1dd
commit 23653f67f0
3 changed files with 23 additions and 7 deletions

View File

@@ -818,4 +818,9 @@ describe('RippleAPI - offline', function() {
assert(!api.isValidAddress(hex));
});
/* eslint-disable no-unused-vars */
it('RippleAPI - implicit server port', function() {
const api = new RippleAPI({servers: ['wss://s1.ripple.com']});
});
/* eslint-enable no-unused-vars */
});

View File

@@ -106,7 +106,7 @@ describe('Remote', function() {
assert.throws(
function() {
new Remote({
servers: [{host: 's-west.ripple.com', port: null, secure: true}]
servers: [{host: 's-west.ripple.com', port: 'null', secure: true}]
});
}, TypeError);
});
@@ -148,21 +148,26 @@ describe('Remote', function() {
);
});
/*
"url" module used in server parses such urls with error, it return
null for port, so in this case default port will be used
it('Server initialization -- url string -- invalid port', function() {
assert.throws(
function() {
new Remote({
servers: ['ws://s-west.ripple.com:null']
servers: ['ws://s-west.ripple.com:invalid']
});
}, Error
);
});
*/
it('Server initialization -- url string -- port out of range', function() {
assert.throws(
function() {
new Remote({
servers: ['ws://s-west.ripple.com:65537:']
servers: ['ws://s-west.ripple.com:65537']
});
}, Error
);