0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/packages/signature/test/jwt.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

15 lines
564 B
TypeScript

import { describe, expect, test } from 'vitest';
import { createRemoteUser } from '@verdaccio/config';
import { signPayload, verifyPayload } from '../src';
describe('verifyJWTPayload', () => {
test('should verify the token and return a remote user', async () => {
const remoteUser = createRemoteUser('foo', []);
const token = await signPayload(remoteUser, '12345');
const verifiedToken = verifyPayload(token, '12345');
expect(verifiedToken.groups).toEqual(remoteUser.groups);
expect(verifiedToken.name).toEqual(remoteUser.name);
});
});