refactor: Overhaul nodes-testing setup - Part 3 (no-changelog) (#14967)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-29 17:42:21 +02:00
committed by GitHub
parent 3e43f9f8bc
commit 979f9e6327
241 changed files with 1868 additions and 2013 deletions

View File

@@ -1,10 +1,7 @@
/* eslint-disable @typescript-eslint/no-loop-func */
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import type { WorkflowTestData } from 'n8n-workflow';
import nock from 'nock';
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
import * as Helpers from '@test/nodes/Helpers';
describe('Test QuickChart Node', () => {
beforeEach(async () => {
nock('https://quickchart.io')
@@ -13,13 +10,12 @@ describe('Test QuickChart Node', () => {
.reply(200, { success: true });
});
const workflow = Helpers.readJsonFileSync('nodes/QuickChart/test/QuickChart.workflow.json');
const testHarness = new NodeTestHarness();
const tests: WorkflowTestData[] = [
{
description: 'nodes/QuickChart/test/QuickChart.workflow.json',
input: {
workflowData: workflow,
workflowData: testHarness.readWorkflowJSON('QuickChart.workflow.json'),
},
output: {
nodeData: {
@@ -89,15 +85,6 @@ describe('Test QuickChart Node', () => {
];
for (const testData of tests) {
test(testData.description, async () => {
const { result } = await executeWorkflow(testData);
const resultNodeData = Helpers.getResultNodeData(result, testData);
resultNodeData.forEach(({ nodeName, resultData }) => {
delete resultData[0]![0].binary;
expect(resultData).toEqual(testData.output.nodeData[nodeName]);
});
expect(result.finished).toEqual(true);
});
testHarness.setupTest(testData);
}
});