mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-28 16:16:24 +00:00
Migrated more short-url reducers to TS
This commit is contained in:
26
test/short-urls/reducers/shortUrlsListParams.test.ts
Normal file
26
test/short-urls/reducers/shortUrlsListParams.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import reducer, {
|
||||
RESET_SHORT_URL_PARAMS,
|
||||
resetShortUrlParams,
|
||||
ShortUrlsListParams,
|
||||
} from '../../../src/short-urls/reducers/shortUrlsListParams';
|
||||
import { LIST_SHORT_URLS } from '../../../src/short-urls/reducers/shortUrlsList';
|
||||
|
||||
describe('shortUrlsListParamsReducer', () => {
|
||||
describe('reducer', () => {
|
||||
const defaultState: ShortUrlsListParams = { page: '1' };
|
||||
|
||||
it('returns params when action is LIST_SHORT_URLS', () =>
|
||||
expect(reducer(undefined, { type: LIST_SHORT_URLS, params: { searchTerm: 'foo', page: '2' } })).toEqual({
|
||||
page: '2',
|
||||
searchTerm: 'foo',
|
||||
}));
|
||||
|
||||
it('returns default value when action is RESET_SHORT_URL_PARAMS', () =>
|
||||
expect(reducer(undefined, { type: RESET_SHORT_URL_PARAMS, params: defaultState })).toEqual(defaultState));
|
||||
});
|
||||
|
||||
describe('resetShortUrlParams', () => {
|
||||
it('returns proper action', () =>
|
||||
expect(resetShortUrlParams()).toEqual({ type: RESET_SHORT_URL_PARAMS }));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user