verdnatura-chat/app/reducers/activeUsers.test.ts

17 lines
637 B
TypeScript
Raw Normal View History

2022-01-24 20:12:36 +00:00
import { setActiveUsers } from '../actions/activeUsers';
import { IActiveUsers, initialState } from './activeUsers';
import { mockedStore } from './mockedStore';
describe('test reducer', () => {
it('should return initial state', () => {
const state = mockedStore.getState().activeUsers;
expect(state).toEqual(initialState);
});
it('should return modified store after action', () => {
const activeUsers: IActiveUsers = { any: { status: 'online', statusText: 'any' } };
mockedStore.dispatch(setActiveUsers(activeUsers));
const state = mockedStore.getState().activeUsers;
expect(state).toEqual({ ...activeUsers });
});
});