mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
14159b31e1
* ref: Relocate utils functions to web pkg * ref: Refactor utils functions * ref: Relocate utils functions to api pkg * ref: Relocate utils functions to config pkg * ref: Relocate utils functions to middleware pkg * ref: Relocate utils functions to storage pkg * ref: relocate utils functions to proxy pkg * ref: relocate utils functions to middleware pkg * ref: refactor utils functions * Fix compilation errors
19 lines
716 B
TypeScript
19 lines
716 B
TypeScript
import { getVersionFromTarball } from '../src/middleware-utils';
|
|
|
|
describe('Utilities', () => {
|
|
describe('getVersionFromTarball', () => {
|
|
test('should get the right version', () => {
|
|
const simpleName = 'test-name-4.2.12.tgz';
|
|
const complexName = 'test-5.6.4-beta.2.tgz';
|
|
const otherComplexName = 'test-3.5.0-6.tgz';
|
|
expect(getVersionFromTarball(simpleName)).toEqual('4.2.12');
|
|
expect(getVersionFromTarball(complexName)).toEqual('5.6.4-beta.2');
|
|
expect(getVersionFromTarball(otherComplexName)).toEqual('3.5.0-6');
|
|
});
|
|
|
|
test("should don'n fall at incorrect tarball name", () => {
|
|
expect(getVersionFromTarball('incorrectName')).toBeUndefined();
|
|
});
|
|
});
|
|
});
|