2021-12-22 19:27:19 +00:00
|
|
|
import { setActiveUsers } from '../actions/activeUsers';
|
2021-12-22 19:33:39 +00:00
|
|
|
import { IActiveUsers, initialState } from './activeUsers';
|
2021-12-22 19:27:19 +00:00
|
|
|
import { mockedStore } from './mockedStore';
|
2021-12-21 20:14:59 +00:00
|
|
|
|
|
|
|
describe('test reducer', () => {
|
2021-12-22 19:33:39 +00:00
|
|
|
it('should return initial state', () => {
|
2021-12-21 20:14:59 +00:00
|
|
|
const state = mockedStore.getState().activeUsers;
|
2021-12-22 19:33:39 +00:00
|
|
|
expect(state).toEqual(initialState);
|
2021-12-21 20:14:59 +00:00
|
|
|
});
|
2021-12-22 19:27:19 +00:00
|
|
|
it('should return modified store after action', () => {
|
2021-12-21 20:14:59 +00:00
|
|
|
const activeUsers: IActiveUsers = { any: { status: 'online', statusText: 'any' } };
|
|
|
|
mockedStore.dispatch(setActiveUsers(activeUsers));
|
|
|
|
const state = mockedStore.getState().activeUsers;
|
|
|
|
expect(state).toEqual({ ...activeUsers });
|
|
|
|
});
|
|
|
|
});
|