refactor(core): Remove roleId indirection (no-changelog) (#8413)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-01-24 13:38:57 +01:00
committed by GitHub
parent 1affebd85e
commit d6deceacde
139 changed files with 922 additions and 1684 deletions

View File

@@ -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');

View File

@@ -18,6 +18,7 @@ import { OrchestrationHandlerWorkerService } from '@/services/orchestration/work
import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service';
import { OrchestrationService } from '@/services/orchestration.service';
import * as testDb from '../shared/testDb';
import { mockInstance } from '../../shared/mocking';
const oclifConfig = new Config({ root: __dirname });
@@ -39,6 +40,11 @@ beforeAll(async () => {
mockInstance(RedisServicePubSubPublisher);
mockInstance(RedisServicePubSubSubscriber);
mockInstance(OrchestrationService);
await testDb.init();
});
afterAll(async () => {
await testDb.terminate();
});
test('worker initializes all its components', async () => {