0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00
verdaccio/packages/signature/test/utilts.spec.ts
Juan Picado 0c7b19b192
chore: migrate vitest packages (#4777)
* 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
2024-08-03 19:39:22 +02:00

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');
});