mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +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,11 +1,8 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { getWorkflowFilenames, testWorkflows } from '@test/nodes/Helpers';
|
||||
|
||||
import { credentials } from '../../__tests__/credentials';
|
||||
|
||||
const workflows = getWorkflowFilenames(__dirname);
|
||||
|
||||
describe('Test AWS Comprehend Node', () => {
|
||||
describe('Detect Language', () => {
|
||||
let mock: nock.Scope;
|
||||
@@ -35,6 +32,6 @@ describe('Test AWS Comprehend Node', () => {
|
||||
mock.post('/').reply(200, response);
|
||||
});
|
||||
|
||||
testWorkflows(workflows, credentials);
|
||||
new NodeTestHarness().setupTests({ credentials });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { getWorkflowFilenames, testWorkflows } from '@test/nodes/Helpers';
|
||||
|
||||
import { credentials } from '../../__tests__/credentials';
|
||||
|
||||
const responseLabels = [
|
||||
@@ -288,7 +287,6 @@ const responseLabels = [
|
||||
|
||||
describe('Test AWS Rekogntion Node', () => {
|
||||
describe('Image Labels Recognition', () => {
|
||||
const workflows = getWorkflowFilenames(__dirname);
|
||||
const baseUrl = 'https://rekognition.eu-central-1.amazonaws.com';
|
||||
let mock: nock.Scope;
|
||||
|
||||
@@ -300,6 +298,6 @@ describe('Test AWS Rekogntion Node', () => {
|
||||
mock.post('/').reply(200, responseLabels);
|
||||
});
|
||||
|
||||
testWorkflows(workflows, credentials);
|
||||
new NodeTestHarness().setupTests({ credentials });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { getWorkflowFilenames, testWorkflows } from '@test/nodes/Helpers';
|
||||
|
||||
import { credentials } from '../../../__tests__/credentials';
|
||||
|
||||
const workflows = getWorkflowFilenames(__dirname);
|
||||
|
||||
describe('Test S3 V1 Node', () => {
|
||||
describe('File Upload', () => {
|
||||
let mock: nock.Scope;
|
||||
@@ -39,6 +36,6 @@ describe('Test S3 V1 Node', () => {
|
||||
.reply(200, { success: true });
|
||||
});
|
||||
|
||||
testWorkflows(workflows, credentials);
|
||||
new NodeTestHarness().setupTests({ credentials });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { getWorkflowFilenames, testWorkflows } from '@test/nodes/Helpers';
|
||||
|
||||
import { credentials } from '../../../__tests__/credentials';
|
||||
|
||||
const workflows = getWorkflowFilenames(__dirname);
|
||||
|
||||
describe('Test S3 V2 Node', () => {
|
||||
describe('File Upload', () => {
|
||||
let mock: nock.Scope;
|
||||
@@ -39,6 +36,6 @@ describe('Test S3 V2 Node', () => {
|
||||
.reply(200, { success: true });
|
||||
});
|
||||
|
||||
testWorkflows(workflows, credentials);
|
||||
new NodeTestHarness().setupTests({ credentials });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import { NodeConnectionTypes, type WorkflowTestData } from 'n8n-workflow';
|
||||
import assert from 'node:assert';
|
||||
import qs from 'node:querystring';
|
||||
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
import * as Helpers from '@test/nodes/Helpers';
|
||||
|
||||
import { credentials } from '../../__tests__/credentials';
|
||||
|
||||
describe('AwsSes Node', () => {
|
||||
const testHarness = new NodeTestHarness();
|
||||
const email = 'test+user@example.com';
|
||||
const templateData = {
|
||||
Name: 'Special. Characters @#$%^&*()_-',
|
||||
@@ -65,7 +64,6 @@ describe('AwsSes Node', () => {
|
||||
},
|
||||
},
|
||||
output: {
|
||||
nodeExecutionOrder: ['Start'],
|
||||
nodeData: {
|
||||
'AWS SES': [[{ json: { success: 'true' } }]],
|
||||
},
|
||||
@@ -153,7 +151,6 @@ describe('AwsSes Node', () => {
|
||||
},
|
||||
},
|
||||
output: {
|
||||
nodeExecutionOrder: ['Start'],
|
||||
nodeData: { 'AWS SES': [[{ json: { success: 'true' } }]] },
|
||||
},
|
||||
nock: {
|
||||
@@ -171,13 +168,7 @@ describe('AwsSes Node', () => {
|
||||
},
|
||||
];
|
||||
|
||||
test.each(tests)('$description', async (testData) => {
|
||||
testData.credentials = credentials;
|
||||
const { result } = await executeWorkflow(testData);
|
||||
const resultNodeData = Helpers.getResultNodeData(result, testData);
|
||||
resultNodeData.forEach(({ nodeName, resultData }) =>
|
||||
expect(resultData).toEqual(testData.output.nodeData[nodeName]),
|
||||
);
|
||||
expect(result.finished).toEqual(true);
|
||||
});
|
||||
for (const testData of tests) {
|
||||
testHarness.setupTest(testData, { credentials });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user