mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
b0b99fa748
The "global" action constants (the ones previously in `actions.js`) have been moved to a separate module. This was necessary to avoid a circular dependency in an upcoming change that was causing problems. In general the "ducks" pattern of organizing Redux stores does result in circular dependency problems. This is because reuse of actions between reducers is encouraged, so it's not uncommon for two reducers to want to reference an action from the other. Going forward we can avoid this problem by moving action constants that are shared between reducers into this shared module.
25 lines
645 B
JavaScript
25 lines
645 B
JavaScript
import assert from 'assert'
|
|
import freeze from 'deep-freeze-strict'
|
|
import reducers from '../../../ui/app/ducks'
|
|
import actionConstants from '../../../ui/app/store/actionConstants'
|
|
|
|
describe('SHOW_ACCOUNT_DETAIL', function () {
|
|
it('updates metamask state', function () {
|
|
const initialState = {
|
|
metamask: {
|
|
selectedAddress: 'foo',
|
|
},
|
|
}
|
|
freeze(initialState)
|
|
|
|
const action = {
|
|
type: actionConstants.SHOW_ACCOUNT_DETAIL,
|
|
value: 'bar',
|
|
}
|
|
freeze(action)
|
|
|
|
const resultingState = reducers(initialState, action)
|
|
assert.equal(resultingState.metamask.selectedAddress, action.value)
|
|
})
|
|
})
|