diff options
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/account-link-test.js | 12 | ||||
-rw-r--r-- | test/unit/config-manager-test.js | 24 |
2 files changed, 35 insertions, 1 deletions
diff --git a/test/unit/account-link-test.js b/test/unit/account-link-test.js new file mode 100644 index 000000000..39889b6be --- /dev/null +++ b/test/unit/account-link-test.js @@ -0,0 +1,12 @@ +var assert = require('assert') +var linkGen = require('../../ui/lib/account-link') + +describe('account-link', function() { + + it('adds testnet prefix to morden test network', function() { + var result = linkGen('account', '2') + assert.notEqual(result.indexOf('testnet'), -1, 'testnet injected') + assert.notEqual(result.indexOf('account'), -1, 'account included') + }) + +}) diff --git a/test/unit/config-manager-test.js b/test/unit/config-manager-test.js index b34089163..6aa7146f0 100644 --- a/test/unit/config-manager-test.js +++ b/test/unit/config-manager-test.js @@ -1,9 +1,10 @@ -var assert = require('assert') +const assert = require('assert') const extend = require('xtend') 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,6 +48,10 @@ 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) { @@ -69,6 +74,12 @@ describe('config-manager', function() { it('should work for JPY as well.', function() { this.timeout(15000) assert.equal(configManager.getConversionRate(), false) + + var jpyMock = 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') @@ -233,6 +244,17 @@ describe('config-manager', function() { assert.equal(result.length, 1) assert.equal(result[0].id, 1) }) + + it('cuts off early txs beyond a limit', function() { + const limit = configManager.txLimit + for (let i = 0; i < limit + 1; i++) { + let tx = { id: i } + configManager.addTx(tx) + } + var result = configManager.getTxList() + assert.equal(result.length, limit, `limit of ${limit} txs enforced`) + assert.equal(result[0].id, 1, 'early txs truncted') + }) }) describe('#confirmTx', function() { |