mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { determineOrderDir } from '../../../src/utils/helpers/ordering';
|
|
|
|
describe('ordering', () => {
|
|
describe('determineOrderDir', () => {
|
|
it('returns ASC when current order field and selected field are different', () => {
|
|
expect(determineOrderDir('foo', 'bar')).toEqual('ASC');
|
|
expect(determineOrderDir('bar', 'foo')).toEqual('ASC');
|
|
});
|
|
|
|
it('returns ASC when no current order dir is provided', () => {
|
|
expect(determineOrderDir('foo', 'foo')).toEqual('ASC');
|
|
expect(determineOrderDir('bar', 'bar')).toEqual('ASC');
|
|
});
|
|
|
|
it('returns DESC when current order field and selected field are equal and current order dir is ASC', () => {
|
|
expect(determineOrderDir('foo', 'foo', 'ASC')).toEqual('DESC');
|
|
expect(determineOrderDir('bar', 'bar', 'ASC')).toEqual('DESC');
|
|
});
|
|
|
|
it('returns undefined when current order field and selected field are equal and current order dir is DESC', () => {
|
|
expect(determineOrderDir('foo', 'foo', 'DESC')).toBeUndefined();
|
|
expect(determineOrderDir('bar', 'bar', 'DESC')).toBeUndefined();
|
|
});
|
|
});
|
|
|
|
describe('orderToString', () => {
|
|
test.todo('casts the order to string');
|
|
});
|
|
|
|
describe('stringToOrder', () => {
|
|
test.todo('casts a string to an order objects');
|
|
});
|
|
});
|