mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Abstract away InstanceSettings and encryptionKey into injectable services (no-changelog) (#7471)
This change ensures that things like `encryptionKey` and `instanceId` are always available directly where they are needed, instead of passing them around throughout the code.
This commit is contained in:
committed by
GitHub
parent
519680c2cf
commit
b6de910cbe
@@ -4,6 +4,8 @@ import config from '@/config';
|
||||
import { flushPromises } from './Helpers';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { mockInstance } from '../integration/shared/utils';
|
||||
import { InstanceSettings } from 'n8n-core';
|
||||
|
||||
jest.unmock('@/telemetry');
|
||||
jest.mock('@/license/License.service', () => {
|
||||
@@ -28,6 +30,7 @@ describe('Telemetry', () => {
|
||||
let telemetry: Telemetry;
|
||||
const instanceId = 'Telemetry unit test';
|
||||
const testDateTime = new Date('2022-01-01 00:00:00');
|
||||
const instanceSettings = mockInstance(InstanceSettings, { instanceId });
|
||||
|
||||
beforeAll(() => {
|
||||
startPulseSpy = jest
|
||||
@@ -49,11 +52,10 @@ describe('Telemetry', () => {
|
||||
beforeEach(async () => {
|
||||
spyTrack.mockClear();
|
||||
|
||||
const postHog = new PostHogClient();
|
||||
await postHog.init(instanceId);
|
||||
const postHog = new PostHogClient(instanceSettings);
|
||||
await postHog.init();
|
||||
|
||||
telemetry = new Telemetry(postHog, mock());
|
||||
telemetry.setInstanceId(instanceId);
|
||||
telemetry = new Telemetry(postHog, mock(), instanceSettings);
|
||||
(telemetry as any).rudderStack = mockRudderStack;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user