refactor: Overhaul nodes-testing setup - Part 1 (no-changelog) (#14303)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-01 10:15:13 +02:00
committed by GitHub
parent f85b851851
commit 73e8d76e13
165 changed files with 3397 additions and 6453 deletions

View File

@@ -1,9 +1,8 @@
import type { INodeTypes } from 'n8n-workflow';
import type { WorkflowTestData } from 'n8n-workflow';
import nock from 'nock';
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
import { setup, workflowToTests, getWorkflowFilenames } from '@test/nodes/Helpers';
import type { WorkflowTestData } from '@test/nodes/types';
import { workflowToTests, getWorkflowFilenames } from '@test/nodes/Helpers';
describe('Test N8n Node, expect base_url to be received from credentials', () => {
const workflows = getWorkflowFilenames(__dirname);
@@ -14,15 +13,14 @@ describe('Test N8n Node, expect base_url to be received from credentials', () =>
const baseUrl = 'https://test.app.n8n.cloud/api/v1';
nock(baseUrl).get('/workflows?tags=n8n-test').reply(200, {});
});
const nodeTypes = setup(tests);
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
const { result } = await executeWorkflow(testData, types);
const testNode = async (testData: WorkflowTestData) => {
const { result } = await executeWorkflow(testData);
expect(result.finished).toEqual(true);
};
for (const testData of tests) {
test(testData.description, async () => await testNode(testData, nodeTypes));
test(testData.description, async () => await testNode(testData));
}
});