aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-09-28 07:26:44 +0800
committerGitHub <noreply@github.com>2017-09-28 07:26:44 +0800
commite451655c107a0c0cf8bc688a64cd48fba7e58c54 (patch)
tree448a321264f3d648d6edee7e90c6f487bc31084b /test/unit
parentecf909e140b2fc99afbd15f6f0882dd17e3ecb88 (diff)
parent15b2823e546cfefd7e867f078b4385ddc6be3a0f (diff)
downloadtangerine-wallet-browser-e451655c107a0c0cf8bc688a64cd48fba7e58c54.tar
tangerine-wallet-browser-e451655c107a0c0cf8bc688a64cd48fba7e58c54.tar.gz
tangerine-wallet-browser-e451655c107a0c0cf8bc688a64cd48fba7e58c54.tar.bz2
tangerine-wallet-browser-e451655c107a0c0cf8bc688a64cd48fba7e58c54.tar.lz
tangerine-wallet-browser-e451655c107a0c0cf8bc688a64cd48fba7e58c54.tar.xz
tangerine-wallet-browser-e451655c107a0c0cf8bc688a64cd48fba7e58c54.tar.zst
tangerine-wallet-browser-e451655c107a0c0cf8bc688a64cd48fba7e58c54.zip
Merge pull request #2177 from MetaMask/new-currency-test
Switching To Infura's Currency API
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/currency-controller-test.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/unit/currency-controller-test.js b/test/unit/currency-controller-test.js
index 5eeaf9bcc..63ab60f9e 100644
--- a/test/unit/currency-controller-test.js
+++ b/test/unit/currency-controller-test.js
@@ -15,11 +15,11 @@ describe('currency-controller', function () {
describe('currency conversions', function () {
describe('#setCurrentCurrency', function () {
it('should return USD as default', function () {
- assert.equal(currencyController.getCurrentCurrency(), 'USD')
+ assert.equal(currencyController.getCurrentCurrency(), 'usd')
})
it('should be able to set to other currency', function () {
- assert.equal(currencyController.getCurrentCurrency(), 'USD')
+ assert.equal(currencyController.getCurrentCurrency(), 'usd')
currencyController.setCurrentCurrency('JPY')
var result = currencyController.getCurrentCurrency()
assert.equal(result, 'JPY')
@@ -36,12 +36,12 @@ describe('currency-controller', function () {
describe('#updateConversionRate', function () {
it('should retrieve an update for ETH to USD and set it in memory', function (done) {
this.timeout(15000)
- nock('https://api.cryptonator.com')
- .get('/api/ticker/eth-USD')
- .reply(200, '{"ticker":{"base":"ETH","target":"USD","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')
+ nock('https://api.infura.io')
+ .get('/v1/ticker/ethusd')
+ .reply(200, '{"base": "ETH", "quote": "USD", "bid": 288.45, "ask": 288.46, "volume": 112888.17569277, "exchange": "bitfinex", "total_volume": 272175.00106721005, "num_exchanges": 8, "timestamp": 1506444677}')
assert.equal(currencyController.getConversionRate(), 0)
- currencyController.setCurrentCurrency('USD')
+ currencyController.setCurrentCurrency('usd')
currencyController.updateConversionRate()
.then(function () {
var result = currencyController.getConversionRate()
@@ -57,14 +57,14 @@ describe('currency-controller', function () {
this.timeout(15000)
assert.equal(currencyController.getConversionRate(), 0)
- nock('https://api.cryptonator.com')
- .get('/api/ticker/eth-JPY')
- .reply(200, '{"ticker":{"base":"ETH","target":"JPY","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')
+ nock('https://api.infura.io')
+ .get('/v1/ticker/ethjpy')
+ .reply(200, '{"base": "ETH", "quote": "JPY", "bid": 32300.0, "ask": 32400.0, "volume": 247.4616071, "exchange": "kraken", "total_volume": 247.4616071, "num_exchanges": 1, "timestamp": 1506444676}')
var promise = new Promise(
function (resolve, reject) {
- currencyController.setCurrentCurrency('JPY')
+ currencyController.setCurrentCurrency('jpy')
currencyController.updateConversionRate().then(function () {
resolve()
})