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

29 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-02-28 18:00:47 +00:00
import { encryptionSet, encryptionInit, encryptionSetBanner } from '../actions/encryption';
import { mockedStore } from './mockedStore';
import { initialState } from './encryption';
describe('test encryption reducer', () => {
it('should return initial state', () => {
const state = mockedStore.getState().encryption;
expect(state).toEqual(initialState);
});
it('should return modified store after encryptionSet', () => {
mockedStore.dispatch(encryptionSet(true, 'BANNER'));
const state = mockedStore.getState().encryption;
expect(state).toEqual({ banner: 'BANNER', enabled: true });
});
it('should return empty store after encryptionInit', () => {
mockedStore.dispatch(encryptionInit());
const state = mockedStore.getState().encryption;
expect(state).toEqual({ banner: '', enabled: false });
});
it('should return initial state after encryptionSetBanner', () => {
mockedStore.dispatch(encryptionSetBanner('BANNER_NEW'));
const state = mockedStore.getState().encryption;
expect(state).toEqual({ banner: 'BANNER_NEW', enabled: false });
});
});