diff options
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/actions/restore_vault_test.js | 2 | ||||
-rw-r--r-- | test/unit/actions/tx_test.js | 8 | ||||
-rw-r--r-- | test/unit/idStore-test.js | 18 |
3 files changed, 23 insertions, 5 deletions
diff --git a/test/unit/actions/restore_vault_test.js b/test/unit/actions/restore_vault_test.js index 609f5429e..7202abb70 100644 --- a/test/unit/actions/restore_vault_test.js +++ b/test/unit/actions/restore_vault_test.js @@ -20,7 +20,7 @@ describe('#recoverFromSeed(password, seed)', function() { }) // stub out account manager - actions._setAccountManager({ + actions._setKeyringController({ recoverFromSeed(pw, seed, cb) { cb(null, { identities: { diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js index c08a8aa26..e365ee3a3 100644 --- a/test/unit/actions/tx_test.js +++ b/test/unit/actions/tx_test.js @@ -46,7 +46,7 @@ describe('tx confirmation screen', function() { describe('cancelTx', function() { before(function(done) { - actions._setAccountManager({ + actions._setKeyringController({ approveTransaction(txId, cb) { cb('An error!') }, cancelTransaction(txId) { /* noop */ }, clearSeedWordCache(cb) { cb() }, @@ -75,7 +75,7 @@ describe('tx confirmation screen', function() { before(function(done) { alert = () => {/* noop */} - actions._setAccountManager({ + actions._setKeyringController({ approveTransaction(txId, cb) { cb({message: 'An error!'}) }, }) @@ -96,7 +96,7 @@ describe('tx confirmation screen', function() { describe('when there is success', function() { it('should complete tx and go home', function() { - actions._setAccountManager({ + actions._setKeyringController({ approveTransaction(txId, cb) { cb() }, }) @@ -135,7 +135,7 @@ describe('tx confirmation screen', function() { } freeze(initialState) - actions._setAccountManager({ + actions._setKeyringController({ approveTransaction(txId, cb) { cb() }, }) diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js index 31da2cd3d..0a57d2121 100644 --- a/test/unit/idStore-test.js +++ b/test/unit/idStore-test.js @@ -2,6 +2,7 @@ var assert = require('assert') var IdentityStore = require('../../app/scripts/lib/idStore') var configManagerGen = require('../lib/mock-config-manager') const ethUtil = require('ethereumjs-util') +const BN = ethUtil.BN const async = require('async') describe('IdentityStore', function() { @@ -138,4 +139,21 @@ describe('IdentityStore', function() { }) }) }) + + describe('#addGasBuffer', function() { + const idStore = new IdentityStore({ + configManager: configManagerGen(), + ethStore: { + addAccount(acct) { accounts.push(ethUtil.addHexPrefix(acct)) }, + }, + }) + + const gas = '0x01' + const bnGas = new BN(gas, 16) + const result = idStore.addGasBuffer(gas) + const bnResult = new BN(result, 16) + + assert.ok(bnResult.gt(gas), 'added more gas as buffer.') + assert.equal(result.indexOf('0x'), 0, 'include hex prefix') + }) }) |