mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-03 14:21:49 +00:00
Added option to customize initial state fo the 'Validate URL' option
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import reducer, { SET_REAL_TIME_UPDATES, toggleRealTimeUpdates, setRealTimeUpdatesInterval } from '../../../src/settings/reducers/settings';
|
||||
import reducer, { SET_SETTINGS, toggleRealTimeUpdates, setRealTimeUpdatesInterval } from '../../../src/settings/reducers/settings';
|
||||
|
||||
describe('settingsReducer', () => {
|
||||
const realTimeUpdates = { enabled: true };
|
||||
const shortUrlCreation = { validateUrls: false };
|
||||
const settings = { realTimeUpdates, shortUrlCreation };
|
||||
|
||||
describe('reducer', () => {
|
||||
it('returns realTimeUpdates when action is SET_REAL_TIME_UPDATES', () => {
|
||||
expect(reducer(undefined, { type: SET_REAL_TIME_UPDATES, realTimeUpdates })).toEqual({ realTimeUpdates });
|
||||
expect(reducer(undefined, { type: SET_SETTINGS, realTimeUpdates })).toEqual(settings);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,7 +15,7 @@ describe('settingsReducer', () => {
|
||||
it.each([[ true ], [ false ]])('updates settings with provided value and then loads updates again', (enabled) => {
|
||||
const result = toggleRealTimeUpdates(enabled);
|
||||
|
||||
expect(result).toEqual({ type: SET_REAL_TIME_UPDATES, realTimeUpdates: { enabled } });
|
||||
expect(result).toEqual({ type: SET_SETTINGS, realTimeUpdates: { enabled } });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,7 +23,7 @@ describe('settingsReducer', () => {
|
||||
it.each([[ 0 ], [ 1 ], [ 2 ], [ 10 ]])('updates settings with provided value and then loads updates again', (interval) => {
|
||||
const result = setRealTimeUpdatesInterval(interval);
|
||||
|
||||
expect(result).toEqual({ type: SET_REAL_TIME_UPDATES, realTimeUpdates: { interval } });
|
||||
expect(result).toEqual({ type: SET_SETTINGS, realTimeUpdates: { interval } });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,10 +6,12 @@ import { Input } from 'reactstrap';
|
||||
import createShortUrlsCreator from '../../src/short-urls/CreateShortUrl';
|
||||
import DateInput from '../../src/utils/DateInput';
|
||||
import { ShortUrlCreation } from '../../src/short-urls/reducers/shortUrlCreation';
|
||||
import { Settings } from '../../src/settings/reducers/settings';
|
||||
|
||||
describe('<CreateShortUrl />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
const TagsSelector = () => null;
|
||||
const shortUrlCreation = { validateUrls: true };
|
||||
const shortUrlCreationResult = Mock.all<ShortUrlCreation>();
|
||||
const createShortUrl = jest.fn(async () => Promise.resolve());
|
||||
|
||||
@@ -22,6 +24,7 @@ describe('<CreateShortUrl />', () => {
|
||||
createShortUrl={createShortUrl}
|
||||
selectedServer={null}
|
||||
resetCreateShortUrl={() => {}}
|
||||
settings={Mock.of<Settings>({ shortUrlCreation })}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user