2022-01-13 18:37:14 +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', () => {
|
2022-01-18 12:49:44 +00:00
|
|
|
mockedStore.dispatch(encryptionSet(true, 'BANNER'));
|
2022-01-13 18:37:14 +00:00
|
|
|
const state = mockedStore.getState().encryption;
|
2022-01-18 12:49:44 +00:00
|
|
|
expect(state).toEqual({ banner: 'BANNER', enabled: true });
|
2022-01-13 18:37:14 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should return empty store after encryptionInit', () => {
|
|
|
|
mockedStore.dispatch(encryptionInit());
|
|
|
|
const state = mockedStore.getState().encryption;
|
2022-01-18 12:49:44 +00:00
|
|
|
expect(state).toEqual({ banner: '', enabled: false });
|
2022-01-13 18:37:14 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should return initial state after encryptionSetBanner', () => {
|
2022-01-18 12:49:44 +00:00
|
|
|
mockedStore.dispatch(encryptionSetBanner('BANNER_NEW'));
|
2022-01-13 18:37:14 +00:00
|
|
|
const state = mockedStore.getState().encryption;
|
2022-01-18 12:49:44 +00:00
|
|
|
expect(state).toEqual({ banner: 'BANNER_NEW', enabled: false });
|
2022-01-13 18:37:14 +00:00
|
|
|
});
|
|
|
|
});
|