0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/packages/config/test/utils.spec.ts
Juan Picado 8c10a3ec31
chore: migrate config package to vitest (#4760)
* chore: migrate config package to vitest

* Update pnpm-lock.yaml

* improve win32 test

* Create moody-mugs-pay.md
2024-08-03 09:52:18 +02:00

29 lines
858 B
TypeScript

import { describe, expect, test } from 'vitest';
import { ROLES, createAnonymousRemoteUser, createRemoteUser } from '../src';
describe('createRemoteUser and createAnonymousRemoteUser', () => {
test('should create a remote user with default groups', () => {
expect(createRemoteUser('12345', ['foo', 'bar'])).toEqual({
groups: [
'foo',
'bar',
ROLES.$ALL,
ROLES.$AUTH,
ROLES.DEPRECATED_ALL,
ROLES.DEPRECATED_AUTH,
ROLES.ALL,
],
name: '12345',
real_groups: ['foo', 'bar'],
});
});
test('should create a anonymous remote user with default groups', () => {
expect(createAnonymousRemoteUser()).toEqual({
groups: [ROLES.$ALL, ROLES.$ANONYMOUS, ROLES.DEPRECATED_ALL, ROLES.DEPRECATED_ANONYMOUS],
name: undefined,
real_groups: [],
});
});
});