2018-08-26 11:52:45 +03:00
|
|
|
import reducer, {
|
2018-08-12 19:49:57 +03:00
|
|
|
RESET_SHORT_URL_PARAMS,
|
|
|
|
resetShortUrlParams,
|
|
|
|
} from '../../../src/short-urls/reducers/shortUrlsListParams';
|
|
|
|
import { LIST_SHORT_URLS } from '../../../src/short-urls/reducers/shortUrlsList';
|
|
|
|
|
|
|
|
describe('shortUrlsListParamsReducer', () => {
|
2018-09-07 21:41:21 +03:00
|
|
|
describe('reducer', () => {
|
2018-08-12 19:49:57 +03:00
|
|
|
it('returns params when action is LIST_SHORT_URLS', () =>
|
2020-09-12 18:59:58 +03:00
|
|
|
expect(reducer(undefined, { type: LIST_SHORT_URLS, params: { searchTerm: 'foo', page: '2' } } as any)).toEqual({
|
2020-08-26 19:55:40 +03:00
|
|
|
page: '2',
|
2018-08-26 00:39:27 +03:00
|
|
|
searchTerm: 'foo',
|
2020-09-12 18:59:58 +03:00
|
|
|
orderBy: { dateCreated: 'DESC' },
|
2018-08-26 00:39:27 +03:00
|
|
|
}));
|
2018-08-12 19:49:57 +03:00
|
|
|
|
|
|
|
it('returns default value when action is RESET_SHORT_URL_PARAMS', () =>
|
2020-09-12 18:59:58 +03:00
|
|
|
expect(reducer(undefined, { type: RESET_SHORT_URL_PARAMS } as any)).toEqual({
|
|
|
|
page: '1',
|
|
|
|
orderBy: { dateCreated: 'DESC' },
|
|
|
|
}));
|
2018-08-12 19:49:57 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('resetShortUrlParams', () => {
|
|
|
|
it('returns proper action', () =>
|
2018-08-26 00:39:27 +03:00
|
|
|
expect(resetShortUrlParams()).toEqual({ type: RESET_SHORT_URL_PARAMS }));
|
2018-08-12 19:49:57 +03:00
|
|
|
});
|
|
|
|
});
|