WA-230 Including balances reducer in store
This commit is contained in:
parent
42f2e763b9
commit
5ddc5f7afe
|
@ -3,7 +3,7 @@ import { Map } from 'immutable'
|
|||
import { type Match } from 'react-router-dom'
|
||||
import { SAFE_REDUCER_ID } from '~/routes/safe/store/reducer/safe'
|
||||
import { type Safe } from '~/routes/safe/store/model/safe'
|
||||
import { SafeFactory } from '~/routes/safe/store/test/builder/index.builder'
|
||||
import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
|
||||
import { safeSelector } from '../selectors'
|
||||
|
||||
const buildMathPropsFrom = (address): Match => ({
|
||||
|
@ -19,7 +19,11 @@ const safeSelectorTests = () => {
|
|||
describe('Safe Selector[safeSelector]', () => {
|
||||
it('should return empty list when no safes', () => {
|
||||
// GIVEN
|
||||
const reduxStore = { [SAFE_REDUCER_ID]: Map(), providers: undefined }
|
||||
const reduxStore = {
|
||||
[SAFE_REDUCER_ID]: Map(),
|
||||
providers: undefined,
|
||||
balances: undefined,
|
||||
}
|
||||
const match: Match = buildMathPropsFrom('fooAddress')
|
||||
|
||||
// WHEN
|
||||
|
@ -38,7 +42,11 @@ const safeSelectorTests = () => {
|
|||
const match: Match = buildMathPropsFrom('fooAddress')
|
||||
const undefMatch: Match = buildMathPropsFrom('inventedAddress')
|
||||
|
||||
const reduxStore = { [SAFE_REDUCER_ID]: map, providers: undefined }
|
||||
const reduxStore = {
|
||||
[SAFE_REDUCER_ID]: map,
|
||||
providers: undefined,
|
||||
balances: undefined,
|
||||
}
|
||||
|
||||
// WHEN
|
||||
const oneOwnerSafe = safeSelector(reduxStore, { match })
|
||||
|
|
|
@ -2,14 +2,18 @@
|
|||
import { List, Map } from 'immutable'
|
||||
import { SAFE_REDUCER_ID } from '~/routes/safe/store/reducer/safe'
|
||||
import { type Safe } from '~/routes/safe/store/model/safe'
|
||||
import { SafeFactory } from '~/routes/safe/store/test/builder/index.builder'
|
||||
import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
|
||||
import { safesListSelector } from '../selectors'
|
||||
|
||||
const safesListSelectorTests = () => {
|
||||
describe('Safes Selector[safesSelector]', () => {
|
||||
it('should return empty list when no safes', () => {
|
||||
// GIVEN
|
||||
const reduxStore = { [SAFE_REDUCER_ID]: Map(), providers: undefined }
|
||||
const reduxStore = {
|
||||
[SAFE_REDUCER_ID]: Map(),
|
||||
providers: undefined,
|
||||
balances: undefined,
|
||||
}
|
||||
const emptyList = List([])
|
||||
|
||||
// WHEN
|
||||
|
@ -25,7 +29,11 @@ const safesListSelectorTests = () => {
|
|||
map = map.set('fooAddress', SafeFactory.oneOwnerSafe)
|
||||
map = map.set('barAddress', SafeFactory.twoOwnersSafe)
|
||||
|
||||
const reduxStore = { [SAFE_REDUCER_ID]: map, providers: undefined }
|
||||
const reduxStore = {
|
||||
[SAFE_REDUCER_ID]: map,
|
||||
providers: undefined,
|
||||
balances: undefined,
|
||||
}
|
||||
|
||||
// WHEN
|
||||
const safes = safesListSelector(reduxStore)
|
||||
|
|
|
@ -5,6 +5,7 @@ import { combineReducers, createStore, applyMiddleware, compose, type Reducer, t
|
|||
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 balances, { BALANCE_REDUCER_ID, type State as BalancesState } from '~/routes/safe/store/reducer/balances'
|
||||
|
||||
export const history = createBrowserHistory()
|
||||
|
||||
|
@ -18,12 +19,14 @@ const finalCreateStore = composeEnhancers(applyMiddleware(
|
|||
export type GlobalState = {
|
||||
providers: ProviderState,
|
||||
safes: SafeState,
|
||||
balances: BalancesState,
|
||||
}
|
||||
|
||||
const reducers: Reducer<GlobalState> = combineReducers({
|
||||
routing: routerReducer,
|
||||
[PROVIDER_REDUCER_ID]: provider,
|
||||
[SAFE_REDUCER_ID]: safe,
|
||||
[BALANCE_REDUCER_ID]: balances,
|
||||
})
|
||||
|
||||
const initialState = { [SAFE_REDUCER_ID]: calculateInitialState() }
|
||||
|
|
Loading…
Reference in New Issue