diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-05-26 08:57:57 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-05-26 08:57:57 +0800 |
commit | e8eae89576161722a8b8f4931de0daad62955ab0 (patch) | |
tree | 38e39444dd9185cee84d44b9f6baaec5855f6a4d /test | |
parent | 21af266fde3a9147f43ee1186daae275dc2a5eed (diff) | |
parent | 9f8267225221cd025591852bbf0eb719b6dde9ac (diff) | |
download | tangerine-wallet-browser-e8eae89576161722a8b8f4931de0daad62955ab0.tar tangerine-wallet-browser-e8eae89576161722a8b8f4931de0daad62955ab0.tar.gz tangerine-wallet-browser-e8eae89576161722a8b8f4931de0daad62955ab0.tar.bz2 tangerine-wallet-browser-e8eae89576161722a8b8f4931de0daad62955ab0.tar.lz tangerine-wallet-browser-e8eae89576161722a8b8f4931de0daad62955ab0.tar.xz tangerine-wallet-browser-e8eae89576161722a8b8f4931de0daad62955ab0.tar.zst tangerine-wallet-browser-e8eae89576161722a8b8f4931de0daad62955ab0.zip |
Merge branch 'master' into FixTransactionBackButton
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/reducers/unlock_vault_test.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/unit/reducers/unlock_vault_test.js b/test/unit/reducers/unlock_vault_test.js new file mode 100644 index 000000000..b7540af08 --- /dev/null +++ b/test/unit/reducers/unlock_vault_test.js @@ -0,0 +1,51 @@ +var jsdom = require('mocha-jsdom') +var assert = require('assert') +var freeze = require('deep-freeze-strict') +var path = require('path') +var sinon = require('sinon') + +var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js')) +var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js')) + +describe('#unlockMetamask(selectedAccount)', function() { + + beforeEach(function() { + // sinon allows stubbing methods that are easily verified + this.sinon = sinon.sandbox.create() + }) + + afterEach(function() { + // sinon requires cleanup otherwise it will overwrite context + this.sinon.restore() + }) + + describe('after an error', function() { + it('clears warning', function() { + const warning = 'this is the wrong warning' + const account = 'foo_account' + const initialState = { + appState: { + warning: warning, + } + } + + const resultState = reducers(initialState, actions.unlockMetamask(account)) + assert.equal(resultState.appState.warning, null, 'warning nullified') + }) + }) + + describe('going home after an error', function() { + it('clears warning', function() { + const warning = 'this is the wrong warning' + const account = 'foo_account' + const initialState = { + appState: { + warning: warning, + } + } + + const resultState = reducers(initialState, actions.goHome()) + assert.equal(resultState.appState.warning, null, 'warning nullified') + }) + }) +}) |