aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-05-26 06:39:18 +0800
committerDan Finlay <dan@danfinlay.com>2016-05-26 06:39:18 +0800
commite8c88a55512a22b14fd453c72f744abd48977e64 (patch)
tree2c27b527e2b9d2f1aa41c635b6a0a8492737e932 /test/unit
parentb2b7e7ff7e57a5ce300f9fcc0b5a621004f01ced (diff)
downloadtangerine-wallet-browser-e8c88a55512a22b14fd453c72f744abd48977e64.tar
tangerine-wallet-browser-e8c88a55512a22b14fd453c72f744abd48977e64.tar.gz
tangerine-wallet-browser-e8c88a55512a22b14fd453c72f744abd48977e64.tar.bz2
tangerine-wallet-browser-e8c88a55512a22b14fd453c72f744abd48977e64.tar.lz
tangerine-wallet-browser-e8c88a55512a22b14fd453c72f744abd48977e64.tar.xz
tangerine-wallet-browser-e8c88a55512a22b14fd453c72f744abd48977e64.tar.zst
tangerine-wallet-browser-e8c88a55512a22b14fd453c72f744abd48977e64.zip
Fix persistent warning bug
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/reducers/unlock_vault_test.js51
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')
+ })
+ })
+})