mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Remove roleId indirection (no-changelog) (#8413)
This commit is contained in:
committed by
GitHub
parent
1affebd85e
commit
d6deceacde
@@ -1,5 +1,4 @@
|
||||
import { Reset } from '@/commands/user-management/reset';
|
||||
import type { Role } from '@db/entities/Role';
|
||||
import { InternalHooks } from '@/InternalHooks';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
@@ -8,18 +7,13 @@ import { UserRepository } from '@db/repositories/user.repository';
|
||||
|
||||
import { mockInstance } from '../../shared/mocking';
|
||||
import * as testDb from '../shared/testDb';
|
||||
import { getGlobalOwnerRole } from '../shared/db/roles';
|
||||
import { createUser } from '../shared/db/users';
|
||||
|
||||
let globalOwnerRole: Role;
|
||||
|
||||
beforeAll(async () => {
|
||||
mockInstance(InternalHooks);
|
||||
mockInstance(LoadNodesAndCredentials);
|
||||
mockInstance(NodeTypes);
|
||||
await testDb.init();
|
||||
|
||||
globalOwnerRole = await getGlobalOwnerRole();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -32,11 +26,11 @@ afterAll(async () => {
|
||||
|
||||
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
||||
test.skip('user-management:reset should reset DB to default user state', async () => {
|
||||
await createUser({ globalRole: globalOwnerRole });
|
||||
await createUser({ role: 'global:owner' });
|
||||
|
||||
await Reset.run();
|
||||
|
||||
const user = await Container.get(UserRepository).findOneBy({ globalRoleId: globalOwnerRole.id });
|
||||
const user = await Container.get(UserRepository).findOneBy({ role: 'global:owner' });
|
||||
|
||||
if (!user) {
|
||||
fail('No owner found after DB reset to default user state');
|
||||
|
||||
Reference in New Issue
Block a user