mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Added tests for new ordering helper functions and updated changelog
This commit is contained in:
parent
49c841ca07
commit
3274088b54
4 changed files with 18 additions and 6 deletions
|
@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
* [#535](https://github.com/shlinkio/shlink-web-client/pull/535) Allowed editing default domain redirects when consuming Shlink 2.10 or newer.
|
* [#535](https://github.com/shlinkio/shlink-web-client/pull/535) Allowed editing default domain redirects when consuming Shlink 2.10 or newer.
|
||||||
* [#531](https://github.com/shlinkio/shlink-web-client/pull/531) Added custom slug field to the basic creation form in the Overview page.
|
* [#531](https://github.com/shlinkio/shlink-web-client/pull/531) Added custom slug field to the basic creation form in the Overview page.
|
||||||
* [#537](https://github.com/shlinkio/shlink-web-client/pull/537) Allowed to customize the ordering for every list in the app that supports it, being currently tags and short URLs.
|
* [#537](https://github.com/shlinkio/shlink-web-client/pull/537) Allowed to customize the ordering for every list in the app that supports it, being currently tags and short URLs.
|
||||||
|
* [#542](https://github.com/shlinkio/shlink-web-client/pull/542) Added ordering for short URLs to the query, so that it is consistent with the rest of the filtering params.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* [#534](https://github.com/shlinkio/shlink-web-client/pull/534) Updated axios.
|
* [#534](https://github.com/shlinkio/shlink-web-client/pull/534) Updated axios.
|
||||||
|
|
|
@ -12,7 +12,6 @@ import Paginator from '../../src/short-urls/Paginator';
|
||||||
import { ReachableServer } from '../../src/servers/data';
|
import { ReachableServer } from '../../src/servers/data';
|
||||||
import { ShortUrlListRouteParams } from '../../src/short-urls/helpers/hooks';
|
import { ShortUrlListRouteParams } from '../../src/short-urls/helpers/hooks';
|
||||||
import { Settings } from '../../src/settings/reducers/settings';
|
import { Settings } from '../../src/settings/reducers/settings';
|
||||||
import ShortUrlsFilteringBar from '../../src/short-urls/ShortUrlsFilteringBar';
|
|
||||||
|
|
||||||
describe('<ShortUrlsList />', () => {
|
describe('<ShortUrlsList />', () => {
|
||||||
let wrapper: ShallowWrapper;
|
let wrapper: ShallowWrapper;
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe('date', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isBetween', () => {
|
describe('isBetween', () => {
|
||||||
test.each([
|
it.each([
|
||||||
[ now, undefined, undefined, true ],
|
[ now, undefined, undefined, true ],
|
||||||
[ now, subDays(now, 1), undefined, true ],
|
[ now, subDays(now, 1), undefined, true ],
|
||||||
[ now, now, undefined, true ],
|
[ now, now, undefined, true ],
|
||||||
|
@ -52,7 +52,7 @@ describe('date', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isBeforeOrEqual', () => {
|
describe('isBeforeOrEqual', () => {
|
||||||
test.each([
|
it.each([
|
||||||
[ now, now, true ],
|
[ now, now, true ],
|
||||||
[ now, addDays(now, 1), true ],
|
[ now, addDays(now, 1), true ],
|
||||||
[ now, subDays(now, 1), false ],
|
[ now, subDays(now, 1), false ],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { determineOrderDir } from '../../../src/utils/helpers/ordering';
|
import { determineOrderDir, OrderDir, orderToString, stringToOrder } from '../../../src/utils/helpers/ordering';
|
||||||
|
|
||||||
describe('ordering', () => {
|
describe('ordering', () => {
|
||||||
describe('determineOrderDir', () => {
|
describe('determineOrderDir', () => {
|
||||||
|
@ -24,10 +24,22 @@ describe('ordering', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('orderToString', () => {
|
describe('orderToString', () => {
|
||||||
test.todo('casts the order to string');
|
it.each([
|
||||||
|
[{}, undefined ],
|
||||||
|
[{ field: 'foo' }, undefined ],
|
||||||
|
[{ field: 'foo', dir: 'ASC' as OrderDir }, 'foo-ASC' ],
|
||||||
|
[{ field: 'bar', dir: 'DESC' as OrderDir }, 'bar-DESC' ],
|
||||||
|
])('casts the order to string', (order, expectedResult) => {
|
||||||
|
expect(orderToString(order)).toEqual(expectedResult);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('stringToOrder', () => {
|
describe('stringToOrder', () => {
|
||||||
test.todo('casts a string to an order objects');
|
it.each([
|
||||||
|
[ 'foo-ASC', { field: 'foo', dir: 'ASC' }],
|
||||||
|
[ 'bar-DESC', { field: 'bar', dir: 'DESC' }],
|
||||||
|
])('casts a string to an order objects', (order, expectedResult) => {
|
||||||
|
expect(stringToOrder(order)).toEqual(expectedResult);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue