fix(utils): rename `talgistOrderParser` to `taglistOrderParser` 🤦

This commit is contained in:
Joxit 2023-05-06 22:55:33 +02:00
parent edb5aa97e8
commit b0ea4e5fb8
No known key found for this signature in database
GPG Key ID: F526592B8E012263
2 changed files with 10 additions and 10 deletions

View File

@ -245,7 +245,7 @@ export const taglistOrderVariants = (taglistOrder) => {
}
};
export function talgistOrderParser(taglistOrder) {
export const taglistOrderParser = (taglistOrder) => {
const orders = taglistOrderVariants(taglistOrder)
.split(';')
.filter((e) => e)
@ -261,4 +261,4 @@ export function talgistOrderParser(taglistOrder) {
}, {});
return orders;
}
};

View File

@ -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 assert from 'assert';
@ -36,35 +36,35 @@ describe('utils tests', () => {
});
});
describe('talgistOrderParser', () => {
describe('taglistOrderParser', () => {
it('should have default configuration when empty or undefined', () => {
const expected = { numAsc: true, alphaAsc: true, numFirst: true };
assert.deepEqual(talgistOrderParser(), expected);
assert.deepEqual(talgistOrderParser(''), expected);
assert.deepEqual(taglistOrderParser(), expected);
assert.deepEqual(taglistOrderParser(''), expected);
});
it('should parse correctly `num-asc;alpha-asc` and variants', () => {
const expected = { numAsc: true, alphaAsc: true, numFirst: true };
['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', () => {
const expected = { numAsc: false, alphaAsc: false, numFirst: false };
['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', () => {
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', () => {
const expected = { numAsc: false, alphaAsc: false, numFirst: true };
assert.deepEqual(talgistOrderParser('num-desc;alpha-desc'), expected)
assert.deepEqual(taglistOrderParser('num-desc;alpha-desc'), expected)
});
});
});