diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-08-25 04:58:50 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-08-25 04:58:50 +0800 |
commit | c82a494b4bc3bd12da52356119698cc380128669 (patch) | |
tree | d556bfcb4541ab8aed2a13dd9e1fa306ad19681a /app/scripts/lib | |
parent | e42b35398bd288a2ce3a93413d0af551dcae2e95 (diff) | |
download | tangerine-wallet-browser-c82a494b4bc3bd12da52356119698cc380128669.tar tangerine-wallet-browser-c82a494b4bc3bd12da52356119698cc380128669.tar.gz tangerine-wallet-browser-c82a494b4bc3bd12da52356119698cc380128669.tar.bz2 tangerine-wallet-browser-c82a494b4bc3bd12da52356119698cc380128669.tar.lz tangerine-wallet-browser-c82a494b4bc3bd12da52356119698cc380128669.tar.xz tangerine-wallet-browser-c82a494b4bc3bd12da52356119698cc380128669.tar.zst tangerine-wallet-browser-c82a494b4bc3bd12da52356119698cc380128669.zip |
Implement usage of nock.
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/config-manager.js | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index a37447fa2..715efb42e 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -288,29 +288,19 @@ ConfigManager.prototype.getCurrentFiat = function () { return ('fiatCurrency' in data) && data.fiatCurrency } -ConfigManager.prototype.updateConversionRate = function (mock = false, mockCurrency = 'USD') { +ConfigManager.prototype.updateConversionRate = function () { var data = this.getData() - if (!mock) { - return rp(`https://www.cryptonator.com/api/ticker/eth-${data.fiatCurrency}`) - .then((response) => { - const parsedResponse = JSON.parse(response) - this.setConversionPrice(parsedResponse.ticker.price) - this.setConversionDate(parsedResponse.timestamp) - }).catch((err) => { - console.error('Error in conversion.', err) - this.setConversionPrice(0) - this.setConversionDate('N/A') - }) - } else { - return new Promise(function(resolve, reject) { resolve() }).then((response) => { - this.setConversionPrice('11.01') - this.setConversionDate(1472065924) - }).catch((err) => { - console.error('Error in conversion.', err) - this.setConversionPrice('11.01') - this.setConversionDate(1472065924) - }) - } + return rp(`https://www.cryptonator.com/api/ticker/eth-${data.fiatCurrency}`) + .then((response) => { + const parsedResponse = JSON.parse(response) + this.setConversionPrice(parsedResponse.ticker.price) + this.setConversionDate(parsedResponse.timestamp) + }).catch((err) => { + console.error('Error in conversion.', err) + this.setConversionPrice(0) + this.setConversionDate('N/A') + }) + } ConfigManager.prototype.setConversionPrice = function (price) { |