mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +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,10 +1,12 @@
|
||||
import { BinaryDataService } from 'n8n-core';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { BinaryDataService, UnrecognizedNodeTypeError, type DirectoryLoader } from 'n8n-core';
|
||||
import { Ftp } from 'n8n-nodes-base/credentials/Ftp.credentials';
|
||||
import { GithubApi } from 'n8n-nodes-base/credentials/GithubApi.credentials';
|
||||
import { Cron } from 'n8n-nodes-base/nodes/Cron/Cron.node';
|
||||
import { ScheduleTrigger } from 'n8n-nodes-base/nodes/Schedule/ScheduleTrigger.node';
|
||||
import { Set } from 'n8n-nodes-base/nodes/Set/Set.node';
|
||||
import { Start } from 'n8n-nodes-base/nodes/Start/Start.node';
|
||||
import { type INode } from 'n8n-workflow';
|
||||
import type { INodeTypeData, INode } from 'n8n-workflow';
|
||||
import type request from 'supertest';
|
||||
import { Container } from 'typedi';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
@@ -62,7 +64,8 @@ export async function initCredentialsTypes(): Promise<void> {
|
||||
* Initialize node types.
|
||||
*/
|
||||
export async function initNodeTypes() {
|
||||
Container.get(LoadNodesAndCredentials).loaded.nodes = {
|
||||
ScheduleTrigger.prototype.trigger = async () => ({});
|
||||
const nodes: INodeTypeData = {
|
||||
'n8n-nodes-base.start': {
|
||||
type: new Start(),
|
||||
sourcePath: '',
|
||||
@@ -75,7 +78,21 @@ export async function initNodeTypes() {
|
||||
type: new Set(),
|
||||
sourcePath: '',
|
||||
},
|
||||
'n8n-nodes-base.scheduleTrigger': {
|
||||
type: new ScheduleTrigger(),
|
||||
sourcePath: '',
|
||||
},
|
||||
};
|
||||
const loader = mock<DirectoryLoader>();
|
||||
loader.getNode.mockImplementation((nodeType) => {
|
||||
const node = nodes[`n8n-nodes-base.${nodeType}`];
|
||||
if (!node) throw new UnrecognizedNodeTypeError('n8n-nodes-base', nodeType);
|
||||
return node;
|
||||
});
|
||||
|
||||
const loadNodesAndCredentials = Container.get(LoadNodesAndCredentials);
|
||||
loadNodesAndCredentials.loaders = { 'n8n-nodes-base': loader };
|
||||
loadNodesAndCredentials.loaded.nodes = nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user