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 /test/unit/config-manager-test.js | |
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 'test/unit/config-manager-test.js')
-rw-r--r-- | test/unit/config-manager-test.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/unit/config-manager-test.js b/test/unit/config-manager-test.js index d4fd1d661..e3c7cb27b 100644 --- a/test/unit/config-manager-test.js +++ b/test/unit/config-manager-test.js @@ -4,6 +4,7 @@ const STORAGE_KEY = 'metamask-persistance-key' var configManagerGen = require('../lib/mock-config-manager') var configManager const rp = require('request-promise') +const nock = require('nock') describe('config-manager', function() { @@ -47,12 +48,15 @@ describe('config-manager', function() { describe('#updateConversionRate', function() { it('should retrieve an update for ETH to USD and set it in memory', function(done) { this.timeout(15000) + var usdMock = nock('https://www.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":""}') assert.equal(configManager.getConversionRate(), false) var promise = new Promise( function (resolve, reject) { configManager.setCurrentFiat('USD') - configManager.updateConversionRate(true, 'USD').then(function() { + configManager.updateConversionRate().then(function() { resolve() }) }) @@ -71,10 +75,15 @@ describe('config-manager', function() { this.timeout(15000) assert.equal(configManager.getConversionRate(), false) + var usdMock = nock('https://www.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":""}') + + var promise = new Promise( function (resolve, reject) { configManager.setCurrentFiat('JPY') - configManager.updateConversionRate(true, 'JPY').then(function() { + configManager.updateConversionRate().then(function() { resolve() }) }) |