mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-27 15:39:54 +03:00
fix(utils): rename talgistOrderParser
to taglistOrderParser
🤦
This commit is contained in:
parent
edb5aa97e8
commit
b0ea4e5fb8
2 changed files with 10 additions and 10 deletions
|
@ -245,7 +245,7 @@ export const taglistOrderVariants = (taglistOrder) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export function talgistOrderParser(taglistOrder) {
|
export const taglistOrderParser = (taglistOrder) => {
|
||||||
const orders = taglistOrderVariants(taglistOrder)
|
const orders = taglistOrderVariants(taglistOrder)
|
||||||
.split(';')
|
.split(';')
|
||||||
.filter((e) => e)
|
.filter((e) => e)
|
||||||
|
@ -261,4 +261,4 @@ export function talgistOrderParser(taglistOrder) {
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
return orders;
|
return orders;
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { taglistOrderVariants, talgistOrderParser } from '../src/scripts/utils.js';
|
import { taglistOrderVariants, taglistOrderParser } from '../src/scripts/utils.js';
|
||||||
import { DockerRegistryUIError } from '../src/scripts/error.js';
|
import { DockerRegistryUIError } from '../src/scripts/error.js';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
|
|
||||||
|
@ -36,35 +36,35 @@ describe('utils tests', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('talgistOrderParser', () => {
|
describe('taglistOrderParser', () => {
|
||||||
it('should have default configuration when empty or undefined', () => {
|
it('should have default configuration when empty or undefined', () => {
|
||||||
const expected = { numAsc: true, alphaAsc: true, numFirst: true };
|
const expected = { numAsc: true, alphaAsc: true, numFirst: true };
|
||||||
assert.deepEqual(talgistOrderParser(), expected);
|
assert.deepEqual(taglistOrderParser(), expected);
|
||||||
assert.deepEqual(talgistOrderParser(''), expected);
|
assert.deepEqual(taglistOrderParser(''), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse correctly `num-asc;alpha-asc` and variants', () => {
|
it('should parse correctly `num-asc;alpha-asc` and variants', () => {
|
||||||
const expected = { numAsc: true, alphaAsc: true, numFirst: true };
|
const expected = { numAsc: true, alphaAsc: true, numFirst: true };
|
||||||
['asc', 'num-asc;alpha-asc', 'num-asc'].forEach((e) =>
|
['asc', 'num-asc;alpha-asc', 'num-asc'].forEach((e) =>
|
||||||
assert.deepEqual(talgistOrderParser(e), expected, `wrong result for ${e}`)
|
assert.deepEqual(taglistOrderParser(e), expected, `wrong result for ${e}`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse correctly `alpha-desc;num-desc` and variants', () => {
|
it('should parse correctly `alpha-desc;num-desc` and variants', () => {
|
||||||
const expected = { numAsc: false, alphaAsc: false, numFirst: false };
|
const expected = { numAsc: false, alphaAsc: false, numFirst: false };
|
||||||
['desc', 'alpha-desc;num-desc'].forEach((e) =>
|
['desc', 'alpha-desc;num-desc'].forEach((e) =>
|
||||||
assert.deepEqual(talgistOrderParser(e), expected, `wrong result for ${e}`)
|
assert.deepEqual(taglistOrderParser(e), expected, `wrong result for ${e}`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse correctly `alpha-asc;num-desc` and variants', () => {
|
it('should parse correctly `alpha-asc;num-desc` and variants', () => {
|
||||||
const expected = { numAsc: false, alphaAsc: true, numFirst: false };
|
const expected = { numAsc: false, alphaAsc: true, numFirst: false };
|
||||||
assert.deepEqual(talgistOrderParser('alpha-asc;num-desc'), expected)
|
assert.deepEqual(taglistOrderParser('alpha-asc;num-desc'), expected)
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse correctly `num-desc;alpha-desc` and variants', () => {
|
it('should parse correctly `num-desc;alpha-desc` and variants', () => {
|
||||||
const expected = { numAsc: false, alphaAsc: false, numFirst: true };
|
const expected = { numAsc: false, alphaAsc: false, numFirst: true };
|
||||||
assert.deepEqual(talgistOrderParser('num-desc;alpha-desc'), expected)
|
assert.deepEqual(taglistOrderParser('num-desc;alpha-desc'), expected)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue