mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
0c7b19b192
* chore: migrate core to vitest * chore: migrate url module * chore: migrate tarball package * chore: migrate loader package * chore: migrate hook package * chore: migrate signature package * chore: migrate utils package
20 lines
521 B
TypeScript
20 lines
521 B
TypeScript
import { expect, test } from 'vitest';
|
|
|
|
import {
|
|
TOKEN_VALID_LENGTH,
|
|
createTarballHash,
|
|
generateRandomSecretKey,
|
|
stringToMD5,
|
|
} from '../src/utils';
|
|
|
|
test('token generation length is valid', () => {
|
|
expect(generateRandomSecretKey()).toHaveLength(TOKEN_VALID_LENGTH);
|
|
});
|
|
|
|
test('string to md5 has valid length', () => {
|
|
expect(stringToMD5(Buffer.from('foo'))).toHaveLength(32);
|
|
});
|
|
|
|
test('create a hash of content', () => {
|
|
expect(typeof createTarballHash().update('1').digest('hex')).toEqual('string');
|
|
});
|