mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
chore(core): Use roles from database in global roles (#17853)
This commit is contained in:
@@ -6,7 +6,12 @@ import {
|
||||
randomValidPassword,
|
||||
} from '@n8n/backend-test-utils';
|
||||
import type { User } from '@n8n/db';
|
||||
import { ProjectRelationRepository, UserRepository } from '@n8n/db';
|
||||
import {
|
||||
GLOBAL_ADMIN_ROLE,
|
||||
GLOBAL_MEMBER_ROLE,
|
||||
ProjectRelationRepository,
|
||||
UserRepository,
|
||||
} from '@n8n/db';
|
||||
import { Container } from '@n8n/di';
|
||||
import { Not } from '@n8n/typeorm';
|
||||
|
||||
@@ -52,7 +57,7 @@ describe('InvitationController', () => {
|
||||
|
||||
describe('POST /invitations/:id/accept', () => {
|
||||
test('should fill out a member shell', async () => {
|
||||
const memberShell = await createUserShell('global:member');
|
||||
const memberShell = await createUserShell(GLOBAL_MEMBER_ROLE);
|
||||
|
||||
const memberProps = {
|
||||
inviterId: instanceOwner.id,
|
||||
@@ -83,7 +88,7 @@ describe('InvitationController', () => {
|
||||
});
|
||||
|
||||
test('should fill out an admin shell', async () => {
|
||||
const adminShell = await createUserShell('global:admin');
|
||||
const adminShell = await createUserShell(GLOBAL_ADMIN_ROLE);
|
||||
|
||||
const memberProps = {
|
||||
inviterId: instanceOwner.id,
|
||||
@@ -116,7 +121,7 @@ describe('InvitationController', () => {
|
||||
test('should fail with invalid payloads', async () => {
|
||||
const memberShell = await userRepository.save({
|
||||
email: randomEmail(),
|
||||
role: 'global:member',
|
||||
role: { slug: 'global:member' },
|
||||
});
|
||||
|
||||
const invalidPaylods = [
|
||||
@@ -374,7 +379,7 @@ describe('InvitationController', () => {
|
||||
mailer.invite.mockResolvedValue({ emailSent: true });
|
||||
|
||||
const member = await createMember();
|
||||
const memberShell = await createUserShell('global:member');
|
||||
const memberShell = await createUserShell(GLOBAL_MEMBER_ROLE);
|
||||
const newUserEmail = randomEmail();
|
||||
|
||||
const existingUserEmails = [member.email];
|
||||
|
||||
Reference in New Issue
Block a user