mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-23 12:49:09 +00:00
feat: Create NPM node (#6177)
This commit is contained in:
committed by
GitHub
parent
80831cd7c6
commit
f3bc6f19b6
38
packages/nodes-base/nodes/Npm/test/Npm.node.test.ts
Normal file
38
packages/nodes-base/nodes/Npm/test/Npm.node.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import nock from 'nock';
|
||||
import { testWorkflows, getWorkflowFilenames } from '@test/nodes/Helpers';
|
||||
import { FAKE_CREDENTIALS_DATA } from '@test/nodes/FakeCredentialsMap';
|
||||
|
||||
describe('Test npm Node', () => {
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
|
||||
const { registryUrl } = FAKE_CREDENTIALS_DATA.npmApi;
|
||||
const mock = nock(registryUrl); //.matchHeader('Authorization', `Bearer ${accessToken}`);
|
||||
|
||||
mock.get('/-/package/n8n/dist-tags').reply(200, {
|
||||
latest: '0.225.2',
|
||||
next: '0.226.2',
|
||||
});
|
||||
|
||||
mock.get('/n8n').reply(200, {
|
||||
time: {
|
||||
'0.225.2': '2023-04-25T09:45:36.407Z',
|
||||
'0.226.2': '2023-05-03T09:41:30.844Z',
|
||||
'0.227.0': '2023-05-03T13:44:32.079Z',
|
||||
},
|
||||
});
|
||||
|
||||
mock.get('/n8n/latest').reply(200, {
|
||||
name: 'n8n',
|
||||
version: '0.225.2',
|
||||
rest: 'of the properties',
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
});
|
||||
|
||||
const workflows = getWorkflowFilenames(__dirname);
|
||||
testWorkflows(workflows);
|
||||
});
|
||||
117
packages/nodes-base/nodes/Npm/test/Npm.workflow.test.json
Normal file
117
packages/nodes-base/nodes/Npm/test/Npm.workflow.test.json
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"name": "Test NPM",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"name": "Execute Workflow",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [620, 440]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "distTag",
|
||||
"operation": "getMany",
|
||||
"packageName": "n8n"
|
||||
},
|
||||
"name": "Get All dist-tags",
|
||||
"type": "n8n-nodes-base.npm",
|
||||
"credentials": {
|
||||
"npmApi": {
|
||||
"id": "1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "package",
|
||||
"operation": "getVersions",
|
||||
"packageName": "n8n"
|
||||
},
|
||||
"name": "Get Versions",
|
||||
"type": "n8n-nodes-base.npm",
|
||||
"credentials": {
|
||||
"npmApi": {
|
||||
"id": "1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "package",
|
||||
"operation": "getMetadata",
|
||||
"packageName": "n8n",
|
||||
"packageVersion": "latest"
|
||||
},
|
||||
"name": "Get Metadata",
|
||||
"type": "n8n-nodes-base.npm",
|
||||
"credentials": {
|
||||
"npmApi": {
|
||||
"id": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Get All dist-tags": [
|
||||
{
|
||||
"json": {
|
||||
"latest": "0.225.2",
|
||||
"next": "0.226.2"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Get Versions": [
|
||||
{
|
||||
"json": {
|
||||
"version": "0.227.0",
|
||||
"published_at": "2023-05-03T13:44:32.079Z"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"version": "0.226.2",
|
||||
"published_at": "2023-05-03T09:41:30.844Z"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"version": "0.225.2",
|
||||
"published_at": "2023-04-25T09:45:36.407Z"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Get Metadata": [
|
||||
{
|
||||
"json": {
|
||||
"name": "n8n",
|
||||
"version": "0.225.2",
|
||||
"rest": "of the properties"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"Execute Workflow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get All dist-tags",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Get Versions",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Get Metadata",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user