diff --git a/packages/nodes-base/nodes/SplitInBatches/test/SplitInBatches.node.test.ts b/packages/nodes-base/nodes/SplitInBatches/test/SplitInBatches.node.test.ts new file mode 100644 index 0000000000..21e55f4fd8 --- /dev/null +++ b/packages/nodes-base/nodes/SplitInBatches/test/SplitInBatches.node.test.ts @@ -0,0 +1,4 @@ +import { testWorkflows, getWorkflowFilenames } from '../../../test/nodes/Helpers'; +const workflows = getWorkflowFilenames(__dirname); + +describe('Execute SplitInBatches Node', () => testWorkflows(workflows)); diff --git a/packages/nodes-base/nodes/SplitInBatches/test/SplitInBatches.workflow.json b/packages/nodes-base/nodes/SplitInBatches/test/SplitInBatches.workflow.json new file mode 100644 index 0000000000..8f3ade4e26 --- /dev/null +++ b/packages/nodes-base/nodes/SplitInBatches/test/SplitInBatches.workflow.json @@ -0,0 +1,178 @@ +{ + "name": "Split in Batches Test", + "nodes": [ + { + "parameters": {}, + "id": "86b8149f-b0a0-489c-bb62-e59142988996", + "name": "When clicking \"Execute Workflow\"", + "type": "n8n-nodes-base.manualTrigger", + "typeVersion": 1, + "position": [400, 220] + }, + { + "parameters": { + "batchSize": 1, + "options": {} + }, + "id": "30c5546e-bdcc-44ff-bfca-89c5fb97b678", + "name": "Split In Batches", + "type": "n8n-nodes-base.splitInBatches", + "typeVersion": 1, + "position": [1100, 220] + }, + { + "parameters": { + "values": { + "string": [ + { + "name": "data[0]", + "value": "n8n" + }, + { + "name": "data[1]", + "value": "test" + } + ] + }, + "options": {} + }, + "id": "92d386b8-60be-4f8b-801c-b6459ec206f7", + "name": "Set", + "type": "n8n-nodes-base.set", + "typeVersion": 1, + "position": [640, 220] + }, + { + "parameters": { + "fieldToSplitOut": "data", + "options": {} + }, + "id": "74b7e63e-a9f8-4a82-9e1f-7b2429d9118d", + "name": "Item Lists", + "type": "n8n-nodes-base.itemLists", + "typeVersion": 1, + "position": [860, 220] + }, + { + "parameters": { + "conditions": { + "boolean": [ + { + "value1": "={{ $node[\"Split In Batches\"].context[\"noItemsLeft\"] }}", + "value2": true + } + ] + } + }, + "id": "a5f68369-4e70-4f16-b260-3c8b74517993", + "name": "IF", + "type": "n8n-nodes-base.if", + "typeVersion": 1, + "position": [1280, 220] + }, + { + "parameters": { + "values": { + "string": [ + { + "name": "maxRunIndex", + "value": "={{ $node[\"Split In Batches\"].context[\"maxRunIndex\"] }}" + }, + { + "value": "={{ $node[\"Split In Batches\"].context[\"currentRunIndex\"] }}" + } + ] + }, + "options": {} + }, + "id": "1f44eb0a-5fb7-43a7-8281-84a8a7ec8464", + "name": "Output", + "type": "n8n-nodes-base.set", + "typeVersion": 1, + "position": [1480, 200] + } + ], + "pinData": { + "Output": [ + { + "json": { + "data": "test", + "maxRunIndex": 2, + "propertyName": 1 + } + } + ] + }, + "connections": { + "When clicking \"Execute Workflow\"": { + "main": [ + [ + { + "node": "Set", + "type": "main", + "index": 0 + } + ] + ] + }, + "Split In Batches": { + "main": [ + [ + { + "node": "IF", + "type": "main", + "index": 0 + } + ] + ] + }, + "Set": { + "main": [ + [ + { + "node": "Item Lists", + "type": "main", + "index": 0 + } + ] + ] + }, + "Item Lists": { + "main": [ + [ + { + "node": "Split In Batches", + "type": "main", + "index": 0 + } + ] + ] + }, + "IF": { + "main": [ + [ + { + "node": "Output", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "Split In Batches", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": false, + "settings": {}, + "versionId": "de1a454e-43e9-4c2d-b786-18da5d97940f", + "id": "389", + "meta": { + "instanceId": "REMOVED" + }, + "tags": [] +} diff --git a/packages/nodes-base/test/nodes/Airtable/Airtable.node.test.ts b/packages/nodes-base/test/nodes/Airtable/Airtable.node.test.ts index f5ef28a7a9..706ac41d95 100644 --- a/packages/nodes-base/test/nodes/Airtable/Airtable.node.test.ts +++ b/packages/nodes-base/test/nodes/Airtable/Airtable.node.test.ts @@ -1,12 +1,8 @@ -import { INodeType } from 'n8n-workflow'; import { executeWorkflow } from '../ExecuteWorkflow'; import * as Helpers from '../Helpers'; import { WorkflowTestData } from '../types'; import nock from 'nock'; -import { ManualTrigger } from '../../../nodes/ManualTrigger/ManualTrigger.node'; -import { Airtable } from '../../../nodes/Airtable/Airtable.node'; - const records = [ { id: 'rec2BWBoyS5QsS7pT', diff --git a/packages/nodes-base/test/nodes/If/If.node.test.ts b/packages/nodes-base/test/nodes/If/If.node.test.ts index 6efeab840d..eabff38aa3 100644 --- a/packages/nodes-base/test/nodes/If/If.node.test.ts +++ b/packages/nodes-base/test/nodes/If/If.node.test.ts @@ -1,13 +1,5 @@ -import { INodeType } from 'n8n-workflow'; import * as Helpers from '../Helpers'; import { WorkflowTestData } from '../types'; - -import { ManualTrigger } from '../../../nodes/ManualTrigger/ManualTrigger.node'; -import { Set } from '../../../nodes/Set/Set.node'; -import { If } from '../../../nodes/If/If.node'; -import { NoOp } from '../../../nodes/NoOp/NoOp.node'; -import { Code } from '../../../nodes/Code/Code.node'; - import { executeWorkflow } from '../ExecuteWorkflow'; describe('Execute If Node', () => { diff --git a/packages/nodes-base/test/nodes/Set/SetNode.test.ts b/packages/nodes-base/test/nodes/Set/SetNode.test.ts index fc4370831e..390e5fa023 100644 --- a/packages/nodes-base/test/nodes/Set/SetNode.test.ts +++ b/packages/nodes-base/test/nodes/Set/SetNode.test.ts @@ -1,7 +1,4 @@ -import { INodeType } from 'n8n-workflow'; import * as Helpers from '../Helpers'; -import { Start } from '../../../nodes/Start/Start.node'; -import { Set } from '../../../nodes/Set/Set.node'; import { executeWorkflow } from '../ExecuteWorkflow'; import { WorkflowTestData } from '../types'; diff --git a/packages/nodes-base/test/nodes/Start/StartNode.test.ts b/packages/nodes-base/test/nodes/Start/StartNode.test.ts index 06c536c9cb..3c29c006ca 100644 --- a/packages/nodes-base/test/nodes/Start/StartNode.test.ts +++ b/packages/nodes-base/test/nodes/Start/StartNode.test.ts @@ -1,6 +1,4 @@ -import { INodeType } from 'n8n-workflow'; import * as Helpers from '../Helpers'; -import { Start } from '../../../nodes/Start/Start.node'; import { WorkflowTestData } from '../types'; import { executeWorkflow } from '../ExecuteWorkflow';