mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
refactor: Overhaul nodes-testing setup - Part 1 (no-changelog) (#14303)
This commit is contained in:
committed by
GitHub
parent
f85b851851
commit
73e8d76e13
@@ -1,29 +1,14 @@
|
||||
import type { IHttpRequestMethods } from 'n8n-workflow';
|
||||
import nock from 'nock';
|
||||
|
||||
import { equalityTest, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import { testWorkflows } from '@test/nodes/Helpers';
|
||||
|
||||
const API_RESPONSE = {
|
||||
ok: true,
|
||||
};
|
||||
|
||||
jest.mock('../../../../V2/GenericFunctions', () => {
|
||||
const originalModule = jest.requireActual('../../../../V2/GenericFunctions');
|
||||
return {
|
||||
...originalModule,
|
||||
slackApiRequest: jest.fn(async function (method: IHttpRequestMethods) {
|
||||
if (method === 'POST') {
|
||||
return API_RESPONSE;
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test SlackV2, channel => append', () => {
|
||||
const workflows = ['nodes/Slack/test/v2/node/channel/archive.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
const nodeTypes = setup(tests);
|
||||
nock('https://slack.com').post('/api/conversations.archive').reply(200, API_RESPONSE);
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => await equalityTest(testData, nodeTypes));
|
||||
}
|
||||
const workflows = ['nodes/Slack/test/v2/node/channel/archive.workflow.json'];
|
||||
testWorkflows(workflows);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user