From c3ebb0d10fe3afc21bca7deaab52ab32eefe33f1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 14 Feb 2021 13:28:17 +0100 Subject: [PATCH] Added test for setShortUrlCreationSettings action --- test/settings/reducers/settings.test.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/settings/reducers/settings.test.ts b/test/settings/reducers/settings.test.ts index 42b012af..1bfd1701 100644 --- a/test/settings/reducers/settings.test.ts +++ b/test/settings/reducers/settings.test.ts @@ -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 } }); + }); + }); });