2023-04-12 05:58:05 -07:00
|
|
|
import { createDeferredPromise, IConnections, INode, IRun, Workflow } from 'n8n-workflow';
|
2022-11-09 06:25:00 -08:00
|
|
|
import { WorkflowExecute } from '@/WorkflowExecute';
|
2019-07-26 01:21:31 -07:00
|
|
|
|
|
|
|
import * as Helpers from './Helpers';
|
2023-04-12 05:58:05 -07:00
|
|
|
import { initLogger } from './utils';
|
2019-07-26 01:21:31 -07:00
|
|
|
|
|
|
|
describe('WorkflowExecute', () => {
|
2023-04-12 05:58:05 -07:00
|
|
|
beforeAll(() => {
|
|
|
|
initLogger();
|
|
|
|
});
|
|
|
|
|
2019-07-26 01:21:31 -07:00
|
|
|
describe('run', () => {
|
|
|
|
const tests: Array<{
|
|
|
|
description: string;
|
|
|
|
input: {
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: INode[];
|
|
|
|
connections: IConnections;
|
|
|
|
};
|
|
|
|
};
|
2019-07-26 01:21:31 -07:00
|
|
|
output: {
|
|
|
|
nodeExecutionOrder: string[];
|
|
|
|
nodeData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
[key: string]: any[][];
|
2019-07-26 01:21:31 -07:00
|
|
|
};
|
2021-08-29 11:58:11 -07:00
|
|
|
};
|
2019-07-26 01:21:31 -07:00
|
|
|
}> = [
|
|
|
|
{
|
|
|
|
description: 'should run basic two node workflow',
|
|
|
|
input: {
|
|
|
|
// Leave the workflowData in regular JSON to be able to easily
|
|
|
|
// copy it from/in the UI
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [100, 300],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value1',
|
|
|
|
value: 1,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [280, 300],
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
connections: {
|
|
|
|
Start: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodeExecutionOrder: ['Start', 'Set'],
|
2019-07-26 01:21:31 -07:00
|
|
|
nodeData: {
|
|
|
|
Set: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
description: 'should run node twice when it has two input connections',
|
|
|
|
input: {
|
|
|
|
// Leave the workflowData in regular JSON to be able to easily
|
|
|
|
// copy it from/in the UI
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [100, 300],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value1',
|
|
|
|
value: 1,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set1',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [300, 250],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-3',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value2',
|
|
|
|
value: 2,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set2',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [500, 400],
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
connections: {
|
|
|
|
Start: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set2',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set1: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set2',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodeExecutionOrder: ['Start', 'Set1', 'Set2', 'Set2'],
|
2019-07-26 01:21:31 -07:00
|
|
|
nodeData: {
|
|
|
|
Set1: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
|
|
|
Set2: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value2: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
value2: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
description: 'should run complicated multi node workflow',
|
|
|
|
input: {
|
|
|
|
// Leave the workflowData in regular JSON to be able to easily
|
|
|
|
// copy it from/in the UI
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
mode: 'passThrough',
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Merge4',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [1150, 500],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value2',
|
|
|
|
value: 2,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set2',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [290, 400],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-3',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value4',
|
|
|
|
value: 4,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set4',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [850, 200],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-4',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value3',
|
|
|
|
value: 3,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set3',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [650, 200],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-5',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
mode: 'passThrough',
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Merge4',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [1150, 500],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-6',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Merge3',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [1000, 400],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-7',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
mode: 'passThrough',
|
|
|
|
output: 'input2',
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Merge2',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [700, 400],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-8',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Merge1',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [500, 300],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-9',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2019-07-26 01:21:31 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value1',
|
|
|
|
value: 1,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set1',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [300, 200],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-10',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [100, 300],
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
connections: {
|
|
|
|
Set2: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge1',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge2',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set4: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge3',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set3: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set4',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Merge3: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge4',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Merge2: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge3',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Merge1: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge2',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set1: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set3',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Start: {
|
|
|
|
main: [
|
2019-07-26 01:21:31 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set2',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge4',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
nodeExecutionOrder: [
|
|
|
|
'Start',
|
|
|
|
'Set1',
|
|
|
|
'Set2',
|
|
|
|
'Set3',
|
|
|
|
'Merge1',
|
|
|
|
'Set4',
|
|
|
|
'Merge2',
|
|
|
|
'Merge3',
|
|
|
|
'Merge4',
|
|
|
|
],
|
|
|
|
nodeData: {
|
|
|
|
Set1: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
Set2: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value2: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
Set3: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
value3: 3,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
Set4: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
value3: 3,
|
|
|
|
value4: 4,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
Merge1: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value2: 2,
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
|
|
|
Merge2: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value2: 2,
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
|
|
|
Merge3: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
value3: 3,
|
|
|
|
value4: 4,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value2: 2,
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
|
|
|
Merge4: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
value3: 3,
|
|
|
|
value4: 4,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value2: 2,
|
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
description:
|
|
|
|
'should run workflow also if node has multiple input connections and one is empty',
|
2021-01-18 23:47:02 -08:00
|
|
|
input: {
|
|
|
|
// Leave the workflowData in regular JSON to be able to easily
|
|
|
|
// copy it from/in the UI
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
position: [250, 450],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
conditions: {
|
|
|
|
boolean: [],
|
|
|
|
number: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
value1: '={{Object.keys($json).length}}',
|
|
|
|
operation: 'notEqual',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'IF',
|
|
|
|
type: 'n8n-nodes-base.if',
|
|
|
|
typeVersion: 1,
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2021-08-29 11:58:11 -07:00
|
|
|
position: [650, 350],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Merge1',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-3',
|
2021-08-29 11:58:11 -07:00
|
|
|
position: [1150, 450],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
string: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'test1',
|
|
|
|
value: 'a',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set1',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-4',
|
2021-08-29 11:58:11 -07:00
|
|
|
position: [450, 450],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
string: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'test2',
|
|
|
|
value: 'b',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set2',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
position: [800, 250],
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
connections: {
|
|
|
|
Start: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
IF: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set2',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set1: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'IF',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge1',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set2: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodeExecutionOrder: ['Start', 'Set1', 'IF', 'Set2', 'Merge1'],
|
2021-01-18 23:47:02 -08:00
|
|
|
nodeData: {
|
|
|
|
Merge1: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
test1: 'a',
|
|
|
|
test2: 'b',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test1: 'a',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
description: 'should use empty data if second input does not have any data',
|
|
|
|
input: {
|
|
|
|
// Leave the workflowData in regular JSON to be able to easily
|
|
|
|
// copy it from/in the UI
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [250, 300],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Merge',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [800, 450],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-3',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Merge1',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [1000, 300],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-4',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
conditions: {
|
|
|
|
boolean: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
value2: true,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
string: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
value1: '={{$json["key"]}}',
|
|
|
|
value2: 'a',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
combineOperation: 'any',
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'IF',
|
|
|
|
type: 'n8n-nodes-base.if',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [600, 600],
|
|
|
|
alwaysOutputData: false,
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-5',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'number0',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
string: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'key',
|
|
|
|
value: 'a',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set0',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [450, 300],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-6',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'number1',
|
|
|
|
value: 1,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
string: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'key',
|
|
|
|
value: 'b',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set1',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [450, 450],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-7',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'number2',
|
|
|
|
value: 2,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
string: [
|
2021-01-18 23:47:02 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'key',
|
|
|
|
value: 'c',
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set2',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [450, 600],
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
connections: {
|
|
|
|
Start: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set0',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Merge: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge1',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
IF: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set0: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set1: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set2: {
|
|
|
|
main: [
|
2021-01-18 23:47:02 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'IF',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-01-19 00:08:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodeExecutionOrder: ['Start', 'Set0', 'Set2', 'IF', 'Set1', 'Merge', 'Merge1'],
|
2021-01-18 23:47:02 -08:00
|
|
|
nodeData: {
|
|
|
|
Merge: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
number1: 1,
|
2021-08-29 11:58:11 -07:00
|
|
|
key: 'b',
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
Merge1: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
number0: 0,
|
2021-08-29 11:58:11 -07:00
|
|
|
key: 'a',
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
number1: 1,
|
2021-08-29 11:58:11 -07:00
|
|
|
key: 'b',
|
2021-01-18 23:47:02 -08:00
|
|
|
},
|
2021-02-16 15:16:10 -08:00
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
description:
|
|
|
|
'should use empty data if input of sibling does not receive any data from parent',
|
2021-02-16 15:16:10 -08:00
|
|
|
input: {
|
|
|
|
// Leave the workflowData in regular JSON to be able to easily
|
|
|
|
// copy it from/in the UI
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: [
|
2021-02-16 15:16:10 -08:00
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [250, 300],
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
conditions: {
|
|
|
|
number: [
|
2021-02-16 15:16:10 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
value1: '={{$json["value1"]}}',
|
|
|
|
operation: 'equal',
|
|
|
|
value2: 1,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'IF',
|
|
|
|
type: 'n8n-nodes-base.if',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [650, 300],
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-3',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
string: [],
|
|
|
|
number: [
|
2021-02-16 15:16:10 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value2',
|
|
|
|
value: 2,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set2',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [850, 450],
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-4',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2021-02-16 15:16:10 -08:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value1',
|
|
|
|
value: 1,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set1',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [450, 300],
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-5',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Merge',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [1050, 300],
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
connections: {
|
|
|
|
Start: {
|
|
|
|
main: [
|
2021-02-16 15:16:10 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set1',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
IF: {
|
|
|
|
main: [
|
2021-02-16 15:16:10 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set2',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set2: {
|
|
|
|
main: [
|
2021-02-16 15:16:10 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set1: {
|
|
|
|
main: [
|
2021-02-16 15:16:10 -08:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'IF',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-02-16 15:16:10 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodeExecutionOrder: ['Start', 'Set1', 'IF', 'Set2', 'Merge'],
|
2021-02-16 15:16:10 -08:00
|
|
|
nodeData: {
|
|
|
|
Merge: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value2: 2,
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-07-26 01:21:31 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-05-08 19:49:55 -07:00
|
|
|
{
|
|
|
|
description: 'should not use empty data in sibling if parent did not send any data',
|
|
|
|
input: {
|
|
|
|
// Leave the workflowData in regular JSON to be able to easily
|
|
|
|
// copy it from/in the UI
|
|
|
|
workflowData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodes: [
|
2021-05-08 19:49:55 -07:00
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [250, 300],
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
values: {
|
|
|
|
number: [
|
2021-05-08 19:49:55 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'value1',
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
options: {},
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'Set',
|
|
|
|
type: 'n8n-nodes-base.set',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [450, 300],
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-3',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Merge',
|
|
|
|
type: 'n8n-nodes-base.merge',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [1050, 250],
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-4',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {
|
|
|
|
conditions: {
|
|
|
|
number: [
|
2021-05-08 19:49:55 -07:00
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
value1: '={{$json["value1"]}}',
|
|
|
|
operation: 'equal',
|
|
|
|
value2: 1,
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
name: 'IF',
|
|
|
|
type: 'n8n-nodes-base.if',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [650, 300],
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-5',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'NoOpTrue',
|
|
|
|
type: 'n8n-nodes-base.noOp',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [850, 150],
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-6',
|
2021-08-29 11:58:11 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'NoOpFalse',
|
|
|
|
type: 'n8n-nodes-base.noOp',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [850, 400],
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
2021-08-29 11:58:11 -07:00
|
|
|
connections: {
|
|
|
|
Start: {
|
|
|
|
main: [
|
2021-05-08 19:49:55 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Set',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
Set: {
|
|
|
|
main: [
|
2021-05-08 19:49:55 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'IF',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
IF: {
|
|
|
|
main: [
|
2021-05-08 19:49:55 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'NoOpTrue',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge',
|
|
|
|
type: 'main',
|
|
|
|
index: 1,
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'NoOpFalse',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
2021-08-29 11:58:11 -07:00
|
|
|
NoOpTrue: {
|
|
|
|
main: [
|
2021-05-08 19:49:55 -07:00
|
|
|
[
|
|
|
|
{
|
2021-08-29 11:58:11 -07:00
|
|
|
node: 'Merge',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
2021-05-08 19:49:55 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
2021-08-29 11:58:11 -07:00
|
|
|
nodeExecutionOrder: ['Start', 'Set', 'IF', 'NoOpFalse'],
|
2021-05-08 19:49:55 -07:00
|
|
|
nodeData: {
|
2021-08-29 11:58:11 -07:00
|
|
|
IF: [[]],
|
2021-05-08 19:49:55 -07:00
|
|
|
NoOpFalse: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
value1: 0,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-04-28 10:04:09 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
description:
|
|
|
|
'should display the correct parameters and so correct data when simplified node-versioning is used',
|
|
|
|
input: {
|
|
|
|
workflowData: {
|
|
|
|
nodes: [
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-1',
|
2022-04-28 10:04:09 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [240, 300],
|
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-2',
|
2022-04-28 10:04:09 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'VersionTest1a',
|
|
|
|
type: 'n8n-nodes-base.versionTest',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [460, 300],
|
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-3',
|
2022-04-28 10:04:09 -07:00
|
|
|
parameters: {
|
|
|
|
versionTest: 11,
|
|
|
|
},
|
|
|
|
name: 'VersionTest1b',
|
|
|
|
type: 'n8n-nodes-base.versionTest',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [680, 300],
|
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-4',
|
2022-04-28 10:04:09 -07:00
|
|
|
parameters: {},
|
|
|
|
name: 'VersionTest2a',
|
|
|
|
type: 'n8n-nodes-base.versionTest',
|
|
|
|
typeVersion: 2,
|
|
|
|
position: [880, 300],
|
|
|
|
},
|
|
|
|
{
|
2022-08-03 04:06:53 -07:00
|
|
|
id: 'uuid-5',
|
2022-04-28 10:04:09 -07:00
|
|
|
parameters: {
|
|
|
|
versionTest: 22,
|
|
|
|
},
|
|
|
|
name: 'VersionTest2b',
|
|
|
|
type: 'n8n-nodes-base.versionTest',
|
|
|
|
typeVersion: 2,
|
|
|
|
position: [1080, 300],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
connections: {
|
|
|
|
Start: {
|
|
|
|
main: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
node: 'VersionTest1a',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
VersionTest1a: {
|
|
|
|
main: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
node: 'VersionTest1b',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
VersionTest1b: {
|
|
|
|
main: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
node: 'VersionTest2a',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
VersionTest2a: {
|
|
|
|
main: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
node: 'VersionTest2b',
|
|
|
|
type: 'main',
|
|
|
|
index: 0,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
nodeExecutionOrder: [
|
|
|
|
'Start',
|
|
|
|
'VersionTest1a',
|
|
|
|
'VersionTest1b',
|
|
|
|
'VersionTest2a',
|
|
|
|
'VersionTest2b',
|
|
|
|
],
|
|
|
|
nodeData: {
|
|
|
|
VersionTest1a: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
versionFromNode: 1,
|
|
|
|
versionFromParameter: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
VersionTest1b: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
versionFromNode: 1,
|
|
|
|
versionFromParameter: 11,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
VersionTest2a: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
versionFromNode: 2,
|
|
|
|
versionFromParameter: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
VersionTest2b: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
versionFromNode: 2,
|
|
|
|
versionFromParameter: 22,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-07-26 01:21:31 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
const executionMode = 'manual';
|
|
|
|
const nodeTypes = Helpers.NodeTypes();
|
|
|
|
|
|
|
|
for (const testData of tests) {
|
|
|
|
test(testData.description, async () => {
|
2021-08-29 11:58:11 -07:00
|
|
|
const workflowInstance = new Workflow({
|
|
|
|
id: 'test',
|
|
|
|
nodes: testData.input.workflowData.nodes,
|
|
|
|
connections: testData.input.workflowData.connections,
|
|
|
|
active: false,
|
|
|
|
nodeTypes,
|
|
|
|
});
|
2019-07-26 01:21:31 -07:00
|
|
|
|
|
|
|
const waitPromise = await createDeferredPromise<IRun>();
|
|
|
|
const nodeExecutionOrder: string[] = [];
|
2021-08-29 11:58:11 -07:00
|
|
|
const additionalData = Helpers.WorkflowExecuteAdditionalData(
|
|
|
|
waitPromise,
|
|
|
|
nodeExecutionOrder,
|
|
|
|
);
|
2019-07-26 01:21:31 -07:00
|
|
|
|
|
|
|
const workflowExecute = new WorkflowExecute(additionalData, executionMode);
|
|
|
|
|
2021-08-20 09:08:40 -07:00
|
|
|
const executionData = await workflowExecute.run(workflowInstance);
|
2019-07-26 01:21:31 -07:00
|
|
|
|
|
|
|
const result = await waitPromise.promise();
|
|
|
|
|
2019-08-09 03:19:28 -07:00
|
|
|
// Check if the data from WorkflowExecute is identical to data received
|
|
|
|
// by the webhooks
|
|
|
|
expect(executionData).toEqual(result);
|
|
|
|
|
2019-07-26 01:21:31 -07:00
|
|
|
// Check if the output data of the nodes is correct
|
|
|
|
for (const nodeName of Object.keys(testData.output.nodeData)) {
|
|
|
|
if (result.data.resultData.runData[nodeName] === undefined) {
|
|
|
|
throw new Error(`Data for node "${nodeName}" is missing!`);
|
|
|
|
}
|
|
|
|
|
|
|
|
const resultData = result.data.resultData.runData[nodeName].map((nodeData) => {
|
|
|
|
if (nodeData.data === undefined) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-08-29 11:58:11 -07:00
|
|
|
return nodeData.data.main[0]!.map((entry) => entry.json);
|
2019-07-26 01:21:31 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
// expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
|
|
|
expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if the nodes did execute in the correct order
|
|
|
|
expect(nodeExecutionOrder).toEqual(testData.output.nodeExecutionOrder);
|
|
|
|
|
|
|
|
// Check if other data has correct value
|
|
|
|
expect(result.finished).toEqual(true);
|
|
|
|
expect(result.data.executionData!.contextData).toEqual({});
|
|
|
|
expect(result.data.executionData!.nodeExecutionStack).toEqual([]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|