refactor(core): Use DI for eventBus code - Part 1 (no-changelog) (#8434)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-01-26 12:21:15 +01:00
committed by GitHub
parent 3cc0f81c02
commit 7c49004018
19 changed files with 399 additions and 355 deletions

View File

@@ -3,6 +3,7 @@ import { mock } from 'jest-mock-extended';
import { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { MessageEventBus } from '@/eventbus';
import { Telemetry } from '@/telemetry';
import { OrchestrationService } from '@/services/orchestration.service';
import { WorkflowService } from '@/workflows/workflow.service';
@@ -13,16 +14,14 @@ import { createOwner } from '../shared/db/users';
import { createWorkflow } from '../shared/db/workflows';
let workflowService: WorkflowService;
let activeWorkflowRunner: ActiveWorkflowRunner;
let orchestrationService: OrchestrationService;
const activeWorkflowRunner = mockInstance(ActiveWorkflowRunner);
const orchestrationService = mockInstance(OrchestrationService);
mockInstance(MessageEventBus);
mockInstance(Telemetry);
beforeAll(async () => {
await testDb.init();
activeWorkflowRunner = mockInstance(ActiveWorkflowRunner);
orchestrationService = mockInstance(OrchestrationService);
mockInstance(Telemetry);
workflowService = new WorkflowService(
mock(),
mock(),