refactor(core): Rename EventRelay to EventService (no-changelog) (#10110)

This commit is contained in:
Iván Ovejero
2024-07-19 12:55:38 +02:00
committed by GitHub
parent 222a0862bd
commit aba1c64500
36 changed files with 203 additions and 195 deletions

View File

@@ -1,6 +1,6 @@
import { LicenseErrors, LicenseService } from '@/license/license.service';
import type { License } from '@/License';
import type { EventRelay } from '@/eventbus/event-relay.service';
import type { EventService } from '@/eventbus/event.service';
import type { WorkflowRepository } from '@db/repositories/workflow.repository';
import type { TEntitlement } from '@n8n_io/license-sdk';
import { mock } from 'jest-mock-extended';
@@ -10,13 +10,13 @@ describe('LicenseService', () => {
const license = mock<License>();
const workflowRepository = mock<WorkflowRepository>();
const entitlement = mock<TEntitlement>({ productId: '123' });
const eventRelay = mock<EventRelay>();
const eventService = mock<EventService>();
const licenseService = new LicenseService(
mock(),
license,
workflowRepository,
mock(),
eventRelay,
eventService,
);
license.getMainPlan.mockReturnValue(entitlement);
@@ -67,7 +67,9 @@ describe('LicenseService', () => {
license.renew.mockResolvedValueOnce();
await licenseService.renewLicense();
expect(eventRelay.emit).toHaveBeenCalledWith('license-renewal-attempted', { success: true });
expect(eventService.emit).toHaveBeenCalledWith('license-renewal-attempted', {
success: true,
});
});
test('on failure', async () => {
@@ -76,7 +78,9 @@ describe('LicenseService', () => {
new BadRequestError('Activation key has expired'),
);
expect(eventRelay.emit).toHaveBeenCalledWith('license-renewal-attempted', { success: false });
expect(eventService.emit).toHaveBeenCalledWith('license-renewal-attempted', {
success: false,
});
});
});
});