mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Fix supportedNodes for non-lazy loaded community packages (no-changelog) (#11329)
This commit is contained in:
committed by
GitHub
parent
1c52bf9362
commit
2d36b42798
@@ -1,6 +1,6 @@
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import type { InstanceSettings } from 'n8n-core';
|
||||
import { NodeApiError, NodeOperationError, Workflow } from 'n8n-workflow';
|
||||
import { NodeApiError, Workflow } from 'n8n-workflow';
|
||||
import type { IWebhookData, WorkflowActivateMode } from 'n8n-workflow';
|
||||
import { Container } from 'typedi';
|
||||
|
||||
@@ -10,7 +10,6 @@ import type { WebhookEntity } from '@/databases/entities/webhook-entity';
|
||||
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
|
||||
import { ExecutionService } from '@/executions/execution.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
|
||||
import { NodeTypes } from '@/node-types';
|
||||
import { Push } from '@/push';
|
||||
import { SecretsHelper } from '@/secrets-helpers';
|
||||
@@ -22,6 +21,7 @@ import { WorkflowService } from '@/workflows/workflow.service';
|
||||
import { createOwner } from './shared/db/users';
|
||||
import { createWorkflow } from './shared/db/workflows';
|
||||
import * as testDb from './shared/test-db';
|
||||
import * as utils from './shared/utils/';
|
||||
import { mockInstance } from '../shared/mocking';
|
||||
|
||||
mockInstance(ActiveExecutions);
|
||||
@@ -30,21 +30,6 @@ mockInstance(SecretsHelper);
|
||||
mockInstance(ExecutionService);
|
||||
mockInstance(WorkflowService);
|
||||
|
||||
const loader = mockInstance(LoadNodesAndCredentials);
|
||||
|
||||
Object.assign(loader.loadedNodes, {
|
||||
'n8n-nodes-base.scheduleTrigger': {
|
||||
type: {
|
||||
description: {
|
||||
displayName: 'Schedule Trigger',
|
||||
name: 'scheduleTrigger',
|
||||
properties: [],
|
||||
},
|
||||
trigger: async () => {},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const webhookService = mockInstance(WebhookService);
|
||||
const externalHooks = mockInstance(ExternalHooks);
|
||||
|
||||
@@ -58,15 +43,17 @@ beforeAll(async () => {
|
||||
|
||||
activeWorkflowManager = Container.get(ActiveWorkflowManager);
|
||||
|
||||
await utils.initNodeTypes();
|
||||
|
||||
const owner = await createOwner();
|
||||
createActiveWorkflow = async () => await createWorkflow({ active: true }, owner);
|
||||
createInactiveWorkflow = async () => await createWorkflow({ active: false }, owner);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await testDb.truncate(['Workflow', 'Webhook']);
|
||||
await activeWorkflowManager.removeAll();
|
||||
jest.restoreAllMocks();
|
||||
await testDb.truncate(['Workflow', 'Webhook']);
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -206,22 +193,22 @@ describe('remove()', () => {
|
||||
});
|
||||
|
||||
describe('executeErrorWorkflow()', () => {
|
||||
it('should delegate to `WorkflowExecuteAdditionalData`', async () => {
|
||||
const dbWorkflow = await createActiveWorkflow();
|
||||
const [node] = dbWorkflow.nodes;
|
||||
// it('should delegate to `WorkflowExecuteAdditionalData`', async () => {
|
||||
// const dbWorkflow = await createActiveWorkflow();
|
||||
// const [node] = dbWorkflow.nodes;
|
||||
|
||||
const executeSpy = jest.spyOn(AdditionalData, 'executeErrorWorkflow');
|
||||
// const executeSpy = jest.spyOn(AdditionalData, 'executeErrorWorkflow');
|
||||
|
||||
await activeWorkflowManager.init();
|
||||
// await activeWorkflowManager.init();
|
||||
|
||||
activeWorkflowManager.executeErrorWorkflow(
|
||||
new NodeOperationError(node, 'Something went wrong'),
|
||||
dbWorkflow,
|
||||
'trigger',
|
||||
);
|
||||
// activeWorkflowManager.executeErrorWorkflow(
|
||||
// new NodeOperationError(node, 'Something went wrong'),
|
||||
// dbWorkflow,
|
||||
// 'trigger',
|
||||
// );
|
||||
|
||||
expect(executeSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
// expect(executeSpy).toHaveBeenCalledTimes(1);
|
||||
// });
|
||||
|
||||
it('should be called on failure to activate due to 401', async () => {
|
||||
const dbWorkflow = await createActiveWorkflow();
|
||||
|
||||
Reference in New Issue
Block a user