diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-05-13 16:13:14 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-05-13 16:24:05 +0800 |
commit | 041b5493dc43c9f8b69dc5a1dde4b319638618a7 (patch) | |
tree | d74812d939398896cc275bbf4080faa26aa35e95 /test | |
parent | f2676d12413e379f3876e8e36b73478c66ed6ad0 (diff) | |
download | tangerine-wallet-browser-041b5493dc43c9f8b69dc5a1dde4b319638618a7.tar tangerine-wallet-browser-041b5493dc43c9f8b69dc5a1dde4b319638618a7.tar.gz tangerine-wallet-browser-041b5493dc43c9f8b69dc5a1dde4b319638618a7.tar.bz2 tangerine-wallet-browser-041b5493dc43c9f8b69dc5a1dde4b319638618a7.tar.lz tangerine-wallet-browser-041b5493dc43c9f8b69dc5a1dde4b319638618a7.tar.xz tangerine-wallet-browser-041b5493dc43c9f8b69dc5a1dde4b319638618a7.tar.zst tangerine-wallet-browser-041b5493dc43c9f8b69dc5a1dde4b319638618a7.zip |
Streamlined some transition logic
Fixes #122
Had used multiple actions for some transitions, which would lead to brief intermediary states.
Now making a few actions much more explicit about what they route to, so there is less intermediary logic, and we can transition confidently to the correct view.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/actions/restore_vault_test.js | 8 | ||||
-rw-r--r-- | test/unit/actions/set_selected_account_test.js | 21 |
2 files changed, 28 insertions, 1 deletions
diff --git a/test/unit/actions/restore_vault_test.js b/test/unit/actions/restore_vault_test.js index 5675028b1..609f5429e 100644 --- a/test/unit/actions/restore_vault_test.js +++ b/test/unit/actions/restore_vault_test.js @@ -21,7 +21,13 @@ describe('#recoverFromSeed(password, seed)', function() { // stub out account manager actions._setAccountManager({ - recoverFromSeed(pw, seed, cb) { cb(null, [{}, {}]) }, + recoverFromSeed(pw, seed, cb) { + cb(null, { + identities: { + foo: 'bar' + } + }) + }, }) it('sets metamask.isUnlocked to true', function() { diff --git a/test/unit/actions/set_selected_account_test.js b/test/unit/actions/set_selected_account_test.js index 0487bc5f0..69eb11e47 100644 --- a/test/unit/actions/set_selected_account_test.js +++ b/test/unit/actions/set_selected_account_test.js @@ -26,3 +26,24 @@ describe('SET_SELECTED_ACCOUNT', function() { assert.equal(resultingState.appState.activeAddress, action.value) }); }); + +describe('SHOW_ACCOUNT_DETAIL', function() { + it('updates metamask state', function() { + var initialState = { + metamask: { + selectedAccount: 'foo' + } + } + freeze(initialState) + + const action = { + type: actions.SHOW_ACCOUNT_DETAIL, + value: 'bar', + } + freeze(action) + + var resultingState = reducers(initialState, action) + assert.equal(resultingState.metamask.selectedAccount, action.value) + assert.equal(resultingState.metamask.selectedAddress, action.value) + }) +}) |