Added short URLs orderBy handling to the query state

This commit is contained in:
Alejandro Celaya
2021-12-25 19:51:25 +01:00
parent 91f319df65
commit 49c841ca07
12 changed files with 94 additions and 52 deletions

View File

@@ -12,11 +12,12 @@ import Paginator from '../../src/short-urls/Paginator';
import { ReachableServer } from '../../src/servers/data';
import { ShortUrlListRouteParams } from '../../src/short-urls/helpers/hooks';
import { Settings } from '../../src/settings/reducers/settings';
import ShortUrlsFilteringBar from '../../src/short-urls/ShortUrlsFilteringBar';
describe('<ShortUrlsList />', () => {
let wrapper: ShallowWrapper;
const ShortUrlsTable = () => null;
const SearchBar = () => null;
const ShortUrlsFilteringBar = () => null;
const listShortUrlsMock = jest.fn();
const push = jest.fn();
const shortUrlsList = Mock.of<ShortUrlsListModel>({
@@ -31,7 +32,7 @@ describe('<ShortUrlsList />', () => {
],
},
});
const ShortUrlsList = shortUrlsListCreator(ShortUrlsTable, SearchBar);
const ShortUrlsList = shortUrlsListCreator(ShortUrlsTable, ShortUrlsFilteringBar);
const createWrapper = (defaultOrdering: ShortUrlsOrder = {}) => shallow(
<ShortUrlsList
{...Mock.of<MercureBoundProps>({ mercureInfo: { loading: true } })}
@@ -56,7 +57,7 @@ describe('<ShortUrlsList />', () => {
expect(wrapper.find(ShortUrlsTable)).toHaveLength(1);
expect(wrapper.find(OrderingDropdown)).toHaveLength(1);
expect(wrapper.find(Paginator)).toHaveLength(1);
expect(wrapper.find(SearchBar)).toHaveLength(1);
expect(wrapper.find(ShortUrlsFilteringBar)).toHaveLength(1);
});
it('passes current query to paginator', () => {