mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
e93d6a30a4
* migrate web package to vitest * migrate node-api to vitest * migrate file-locking vitest * migrate cli * remove jest from npm packages * Create weak-cherries-serve.md * update ci
46 lines
803 B
TypeScript
46 lines
803 B
TypeScript
import { describe, expect, test } from 'vitest';
|
|
|
|
import { sortByName } from '../src/web-utils';
|
|
|
|
describe('Utilities', () => {
|
|
describe('Sort packages', () => {
|
|
const packages = [
|
|
{
|
|
name: 'ghc',
|
|
},
|
|
{
|
|
name: 'abc',
|
|
},
|
|
{
|
|
name: 'zxy',
|
|
},
|
|
];
|
|
test('should order ascending', () => {
|
|
expect(sortByName(packages)).toEqual([
|
|
{
|
|
name: 'abc',
|
|
},
|
|
{
|
|
name: 'ghc',
|
|
},
|
|
{
|
|
name: 'zxy',
|
|
},
|
|
]);
|
|
});
|
|
|
|
test('should order descending', () => {
|
|
expect(sortByName(packages, false)).toEqual([
|
|
{
|
|
name: 'zxy',
|
|
},
|
|
{
|
|
name: 'ghc',
|
|
},
|
|
{
|
|
name: 'abc',
|
|
},
|
|
]);
|
|
});
|
|
});
|
|
});
|