refactor(core): Use an IoC container to manage singleton classes [Part-2] (no-changelog) (#5690)

* use typedi for UserManagementMailer

* use typedi for SamlService

* fix typos

* use typedi for Queue

* use typedi for License

* convert some more code to use typedi
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-03-16 15:34:13 +01:00
committed by GitHub
parent c07f838ce6
commit 9bd7529193
39 changed files with 154 additions and 178 deletions

View File

@@ -27,6 +27,8 @@ import { Container } from 'typedi';
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
import { mockInstance } from '../integration/shared/utils';
import { Push } from '@/push';
import { ActiveExecutions } from '@/ActiveExecutions';
import { NodeTypes } from '@/NodeTypes';
/**
* TODO:
@@ -157,12 +159,17 @@ describe('ActiveWorkflowRunner', () => {
beforeEach(() => {
externalHooks = mock();
activeWorkflowRunner = new ActiveWorkflowRunner(externalHooks);
activeWorkflowRunner = new ActiveWorkflowRunner(
new ActiveExecutions(),
externalHooks,
Container.get(NodeTypes),
);
});
afterEach(async () => {
await activeWorkflowRunner.removeAll();
databaseActiveWorkflowsCount = 0;
databaseActiveWorkflowsList = [];
jest.clearAllMocks();
});

View File

@@ -2,6 +2,7 @@ import { Telemetry } from '@/telemetry';
import config from '@/config';
import { flushPromises } from './Helpers';
import { PostHogClient } from '@/posthog';
import { mock } from 'jest-mock-extended';
jest.unmock('@/telemetry');
jest.mock('@/license/License.service', () => {
@@ -45,7 +46,7 @@ describe('Telemetry', () => {
const postHog = new PostHogClient();
postHog.init(instanceId);
telemetry = new Telemetry(postHog);
telemetry = new Telemetry(postHog, mock());
telemetry.setInstanceId(instanceId);
(telemetry as any).rudderStack = {
flush: () => {},