2021-10-29 17:33:05 +02:00
|
|
|
import { ROLES, createAnonymousRemoteUser, createRemoteUser } from '../src';
|
2020-11-08 15:20:02 +01:00
|
|
|
|
2022-07-29 20:51:45 +02:00
|
|
|
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'],
|
2020-11-15 11:14:09 +01:00
|
|
|
});
|
2022-07-29 20:51:45 +02:00
|
|
|
});
|
2020-11-15 11:14:09 +01:00
|
|
|
|
2022-07-29 20:51:45 +02:00
|
|
|
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: [],
|
2020-11-15 11:14:09 +01:00
|
|
|
});
|
|
|
|
});
|
2020-11-08 15:20:02 +01:00
|
|
|
});
|