mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 18:27:25 +03:00
Moved test to the right place
This commit is contained in:
parent
2857e59273
commit
9cbeef1cb4
2 changed files with 25 additions and 23 deletions
25
test/utils/helpers/ordering.test.ts
Normal file
25
test/utils/helpers/ordering.test.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
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();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,29 +1,6 @@
|
|||
import { capitalize, nonEmptyValueOrNull, rangeOf } from '../../src/utils/utils';
|
||||
import { determineOrderDir } from '../../src/utils/helpers/ordering';
|
||||
|
||||
describe('utils', () => {
|
||||
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('rangeOf', () => {
|
||||
const func = (i: number) => `result_${i}`;
|
||||
const size = 5;
|
||||
|
|
Loading…
Reference in a new issue