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

@@ -0,0 +1,44 @@
import type { WorkflowTestData } from 'n8n-workflow';
import nock from 'nock';
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
import * as Helpers from '@test/nodes/Helpers';
const records = [
{
id: 'rec2BWBoyS5QsS7pT',
createdTime: '2022-08-25T08:22:34.000Z',
fields: {
name: 'Tim',
email: 'tim@email.com',
},
},
];
describe('Execute Airtable Node', () => {
beforeEach(() => {
nock('https://api.airtable.com/v0')
.get('/appIaXXdDqS5ORr4V/tbljyBEdYzCPF0NDh?pageSize=100')
.reply(200, { records });
});
const tests: WorkflowTestData[] = [
{
description: 'List Airtable Records',
input: {
workflowData: Helpers.readJsonFileSync('nodes/Airtable/test/workflow.json'),
},
output: {
nodeData: {
Airtable: [[...records.map((r) => ({ json: r }))]],
},
},
},
];
for (const testData of tests) {
test(testData.description, async () => {
await executeWorkflow(testData);
});
}
});