Updated Short URLs list so that it allows setting default orderBy from settings

This commit is contained in:
Alejandro Celaya
2021-12-24 13:14:13 +01:00
parent d8442e435d
commit 57075c581d
12 changed files with 69 additions and 69 deletions

View File

@@ -5,7 +5,7 @@ import { OptionalString } from '../../../src/utils/utils';
import { ShlinkDomain, ShlinkVisitsOverview } from '../../../src/api/types';
import { ShortUrl } from '../../../src/short-urls/data';
import { Visit } from '../../../src/visits/types';
import { OrderDir } from '../../../src/utils/helpers/ordering';
import { ShortUrlsOrder } from '../../../src/short-urls/reducers/shortUrlsListParams';
describe('ShlinkApiClient', () => {
const createAxios = (data: AxiosRequestConfig) => (async () => Promise.resolve(data)) as unknown as AxiosInstance;
@@ -33,9 +33,9 @@ describe('ShlinkApiClient', () => {
});
it.each([
[{ visits: 'DESC' as OrderDir }, 'visits-DESC' ],
[{ longUrl: 'ASC' as OrderDir }, 'longUrl-ASC' ],
[{ longUrl: undefined as OrderDir }, undefined ],
[ { field: 'visits', dir: 'DESC' } as ShortUrlsOrder, 'visits-DESC' ],
[ { field: 'longUrl', dir: 'ASC' } as ShortUrlsOrder, 'longUrl-ASC' ],
[ { field: 'longUrl', dir: undefined } as ShortUrlsOrder, undefined ],
])('parses orderBy in params', async (orderBy, expectedOrderBy) => {
const axiosSpy = createAxiosMock({
data: expectedList,