Added test for setShortUrlCreationSettings action

This commit is contained in:
Alejandro Celaya 2021-02-14 13:28:17 +01:00
parent 4885088d59
commit c3ebb0d10f

View file

@ -1,4 +1,9 @@
import reducer, { SET_SETTINGS, toggleRealTimeUpdates, setRealTimeUpdatesInterval } from '../../../src/settings/reducers/settings';
import reducer, {
SET_SETTINGS,
toggleRealTimeUpdates,
setRealTimeUpdatesInterval,
setShortUrlCreationSettings,
} from '../../../src/settings/reducers/settings';
describe('settingsReducer', () => {
const realTimeUpdates = { enabled: true };
@ -6,7 +11,7 @@ describe('settingsReducer', () => {
const settings = { realTimeUpdates, shortUrlCreation };
describe('reducer', () => {
it('returns realTimeUpdates when action is SET_REAL_TIME_UPDATES', () => {
it('returns realTimeUpdates when action is SET_SETTINGS', () => {
expect(reducer(undefined, { type: SET_SETTINGS, realTimeUpdates })).toEqual(settings);
});
});
@ -26,4 +31,12 @@ describe('settingsReducer', () => {
expect(result).toEqual({ type: SET_SETTINGS, realTimeUpdates: { interval } });
});
});
describe('setShortUrlCreationSettings', () => {
it('creates action to set shortUrlCreation settings', () => {
const result = setShortUrlCreationSettings({ validateUrls: true });
expect(result).toEqual({ type: SET_SETTINGS, shortUrlCreation: { validateUrls: true } });
});
});
});