2020-04-26 20:04:17 +03:00
|
|
|
import reducer, { SET_REAL_TIME_UPDATES, setRealTimeUpdates } from '../../../src/settings/reducers/settings';
|
2020-04-25 11:22:17 +03:00
|
|
|
|
2020-04-26 14:00:23 +03:00
|
|
|
describe('settingsReducer', () => {
|
|
|
|
const realTimeUpdates = { enabled: true };
|
2020-04-25 11:22:17 +03:00
|
|
|
|
|
|
|
describe('reducer', () => {
|
2020-04-26 20:04:17 +03:00
|
|
|
it('returns realTimeUpdates when action is SET_REAL_TIME_UPDATES', () => {
|
|
|
|
expect(reducer({}, { type: SET_REAL_TIME_UPDATES, realTimeUpdates })).toEqual({ realTimeUpdates });
|
2020-04-25 11:22:17 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('setRealTimeUpdates', () => {
|
|
|
|
it.each([[ true ], [ false ]])('updates settings with provided value and then loads updates again', (enabled) => {
|
2020-04-26 20:04:17 +03:00
|
|
|
const result = setRealTimeUpdates(enabled);
|
2020-04-25 11:22:17 +03:00
|
|
|
|
2020-04-26 20:04:17 +03:00
|
|
|
expect(result).toEqual({ type: SET_REAL_TIME_UPDATES, realTimeUpdates: { enabled } });
|
2020-04-25 11:22:17 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|