Fixes test on rateService: github issue #1457
This commit is contained in:
parent
23b055c9e5
commit
59c9553a4e
3 changed files with 19 additions and 13 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue