more unit tests coverage

This commit is contained in:
Ivan Tivonenko
2015-07-23 22:45:18 +03:00
parent 13dee36e93
commit 2c52e4aa69
6 changed files with 105 additions and 21 deletions

View File

@@ -2,6 +2,7 @@
'use strict';
const _ = require('lodash');
const common = require('../common');
// If a ledger is not received in this time, consider the connection offline
@@ -28,8 +29,7 @@ function isConnected(): boolean {
function getServerInfo(callback: (err: any, data: any) => void): void {
this.remote.requestServerInfo((error, response) => {
if (error) {
const message = error && error.remote && error.remote.error_message?
error.remote.error_message : error.message;
const message = _.get(error, ['remote', 'error_message'], error.message);
callback(new common.errors.RippledNetworkError(message));
} else {
callback(null, response.info);