WA-238 Rename calculateInitialState to safeInitialState

This commit is contained in:
apanizo 2018-05-22 11:07:38 +02:00
parent bb3c5127f6
commit 63cb857b7b
3 changed files with 8 additions and 6 deletions

View File

@ -25,7 +25,7 @@ const buildSafesFrom = (loadedSafes: Object): State => {
})
}
export const calculateInitialState = (): State => {
export const safeInitialState = (): State => {
const storedSafes = load(SAFES_KEY)
return storedSafes ? buildSafesFrom(storedSafes) : Map()

View File

@ -1,7 +1,7 @@
// @flow
import { combineReducers, createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import safeReducer, { calculateInitialState, SAFE_REDUCER_ID } from '~/routes/safe/store/reducer/safe'
import safeReducer, { safeInitialState, SAFE_REDUCER_ID } from '~/routes/safe/store/reducer/safe'
import addSafe from '~/routes/safe/store/actions/addSafe'
import * as SafeFields from '~/routes/open/components/fields'
import { getAccountsFrom, getNamesFrom } from '~/routes/open/utils/safeDataExtractor'
@ -70,11 +70,11 @@ const providerReducerTests = () => {
getAccountsFrom(formValues),
))
const anotherStore = aStore({ [SAFE_REDUCER_ID]: calculateInitialState() })
const anotherStore = aStore({ [SAFE_REDUCER_ID]: safeInitialState() })
const safes = anotherStore.getState()[SAFE_REDUCER_ID]
// THEN
expect(calculateInitialState()).toEqual(safes)
expect(safeInitialState()).toEqual(safes)
})
})
}

View File

@ -4,7 +4,7 @@ import { routerMiddleware, routerReducer } from 'react-router-redux'
import { combineReducers, createStore, applyMiddleware, compose, type Reducer, type Store } from 'redux'
import thunk from 'redux-thunk'
import provider, { PROVIDER_REDUCER_ID, type State as ProviderState } from '~/wallets/store/reducer/provider'
import safe, { SAFE_REDUCER_ID, calculateInitialState, type State as SafeState } from '~/routes/safe/store/reducer/safe'
import safe, { SAFE_REDUCER_ID, safeInitialState, type State as SafeState } from '~/routes/safe/store/reducer/safe'
import balances, { BALANCE_REDUCER_ID, type State as BalancesState } from '~/routes/safe/store/reducer/balances'
export const history = createBrowserHistory()
@ -29,7 +29,9 @@ const reducers: Reducer<GlobalState> = combineReducers({
[BALANCE_REDUCER_ID]: balances,
})
const initialState = { [SAFE_REDUCER_ID]: calculateInitialState() }
const initialState = {
[SAFE_REDUCER_ID]: safeInitialState(),
}
export const store: Store<GlobalState> = createStore(reducers, initialState, finalCreateStore)