Fixes test on rateService: github issue #1457

This commit is contained in:
Esteban Ordano 2014-09-22 15:50:19 -03:00
commit 59c9553a4e
3 changed files with 19 additions and 13 deletions

View file

@ -101,5 +101,4 @@ Logger.prototype.setLevel = function(level) {
var logger = new Logger('copay');
logger.setLevel(config.logLevel);
logger.log('Log level:' + config.logLevel);
module.exports = logger;

View file

@ -4,6 +4,7 @@ var RateService = function(request) {
this.isAvailable = false;
this.UNAVAILABLE_ERROR = 'Service is not available - check for service.isAvailable or use service.whenAvailable';
this.SAT_TO_BTC = 1 / 1e8;
this.BTC_TO_SAT = 1e8;
var MINS_IN_HOUR = 60;
var MILLIS_IN_SECOND = 1000;
var rateServiceConfig = config.rate;
@ -62,7 +63,7 @@ RateService.prototype.fromFiat = function(amount, code) {
if (!this.isAvailable) {
throw new Error(this.UNAVAILABLE_ERROR);
}
return amount / this.rates[code] / this.SAT_TO_BTC;
return amount / this.rates[code] * this.BTC_TO_SAT;
};
RateService.prototype.listAlternatives = function() {