mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
14 lines
514 B
TypeScript
14 lines
514 B
TypeScript
|
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);
|
||
|
});
|
||
|
});
|