mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 03:42:16 +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,6 +1,6 @@
|
||||
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 = {
|
||||
object: 'list',
|
||||
@@ -411,24 +411,11 @@ const API_RESPONSE = {
|
||||
request_id: '33358f1b-fc4d-4387-8d95-43c7d03519a5',
|
||||
};
|
||||
|
||||
jest.mock('../../../../shared/GenericFunctions', () => {
|
||||
const originalModule = jest.requireActual('../../../../shared/GenericFunctions');
|
||||
return {
|
||||
...originalModule,
|
||||
notionApiRequest: jest.fn(async function (method: IHttpRequestMethods) {
|
||||
if (method === 'PATCH') {
|
||||
return API_RESPONSE;
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test NotionV2, block => append', () => {
|
||||
const workflows = ['nodes/Notion/test/node/v2/block/append.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
const nodeTypes = setup(tests);
|
||||
nock('https://api.notion.com')
|
||||
.patch('/v1/blocks/90e03468f8aa457695da02ccad963040/children')
|
||||
.reply(200, API_RESPONSE);
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => await equalityTest(testData, nodeTypes));
|
||||
}
|
||||
const workflows = ['nodes/Notion/test/node/v2/block/append.workflow.json'];
|
||||
testWorkflows(workflows);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user