diff --git a/app/reducers/activeUsers.test.ts b/app/reducers/activeUsers.test.ts index 379dcae44..fbe35207a 100644 --- a/app/reducers/activeUsers.test.ts +++ b/app/reducers/activeUsers.test.ts @@ -1,11 +1,11 @@ import { setActiveUsers } from '../actions/activeUsers'; -import { IActiveUsers } from './activeUsers'; +import { IActiveUsers, initialState } from './activeUsers'; import { mockedStore } from './mockedStore'; describe('test reducer', () => { - it('should return {} as initial state', () => { + it('should return initial state', () => { const state = mockedStore.getState().activeUsers; - expect(state).toEqual({}); + expect(state).toEqual(initialState); }); it('should return modified store after action', () => { const activeUsers: IActiveUsers = { any: { status: 'online', statusText: 'any' } }; diff --git a/app/reducers/activeUsers.ts b/app/reducers/activeUsers.ts index e37df651d..8e16fe25b 100644 --- a/app/reducers/activeUsers.ts +++ b/app/reducers/activeUsers.ts @@ -5,7 +5,7 @@ export interface IActiveUsers { [key: string]: ActiveUser; } -const initialState: IActiveUsers = {}; +export const initialState: IActiveUsers = {}; export default function activeUsers(state = initialState, action: ApplicationActions): IActiveUsers { switch (action.type) { diff --git a/app/reducers/selectedUsers.test.ts b/app/reducers/selectedUsers.test.ts index b0f27903c..329be4f91 100644 --- a/app/reducers/selectedUsers.test.ts +++ b/app/reducers/selectedUsers.test.ts @@ -1,12 +1,8 @@ import { addUser, reset, setLoading, removeUser } from '../actions/selectedUsers'; import { mockedStore } from './mockedStore'; +import { initialState } from './selectedUsers'; describe('test selectedUsers reducer', () => { - const initialState = { - users: [], - loading: false - }; - it('should return initial state', () => { const state = mockedStore.getState().selectedUsers; expect(state).toEqual(initialState); @@ -26,7 +22,7 @@ describe('test selectedUsers reducer', () => { expect(state).toEqual([]); }); - it('should return initialState after reset', () => { + it('should return initial state after reset', () => { mockedStore.dispatch(reset()); const state = mockedStore.getState().selectedUsers; expect(state).toEqual(initialState); diff --git a/app/reducers/selectedUsers.ts b/app/reducers/selectedUsers.ts index 265964948..a31a01f1a 100644 --- a/app/reducers/selectedUsers.ts +++ b/app/reducers/selectedUsers.ts @@ -6,7 +6,7 @@ export interface ISelectedUsers { loading: boolean; } -const initialState: ISelectedUsers = { +export const initialState: ISelectedUsers = { users: [], loading: false };