test(Split In Batches Node): Add test for Split in Batches node (no-changelog) (#5381)

This commit is contained in:
Jonathan Bennetts 2023-02-08 12:15:36 +00:00 committed by GitHub
parent d7b3923c2f
commit f44b4b1314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 182 additions and 17 deletions

View file

@ -0,0 +1,4 @@
import { testWorkflows, getWorkflowFilenames } from '../../../test/nodes/Helpers';
const workflows = getWorkflowFilenames(__dirname);
describe('Execute SplitInBatches Node', () => testWorkflows(workflows));

View file

@ -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": []
}

View file

@ -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',

View file

@ -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', () => {

View file

@ -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';

View file

@ -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';