mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor: Overhaul nodes-testing setup - Part 3 (no-changelog) (#14967)
This commit is contained in:
committed by
GitHub
parent
3e43f9f8bc
commit
979f9e6327
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user