first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,282 @@
|
||||
{
|
||||
"name": "If node unit test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "cc223c0f-eae7-4647-907a-8e44f1762442",
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-2440, 520]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"value": true,
|
||||
"value2": false
|
||||
},
|
||||
{
|
||||
"value": false,
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "2aa0a57b-b25a-4293-b7bf-fc240d4d21f4",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [-2240, 520]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json[\"value\"] }}",
|
||||
"value2": true
|
||||
},
|
||||
{
|
||||
"value1": "={{ $json.value2 }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"combineOperation": "any"
|
||||
},
|
||||
"id": "44d65f81-a358-4ec3-bea6-9760b1dba386",
|
||||
"name": "IF ANY",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2000, 700],
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "db5d7a75-18d4-4721-bb81-1a9f8f4fce01",
|
||||
"name": "On True ANY",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-1760, 620]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "033fe413-65fe-413d-87d7-53358c8e43a1",
|
||||
"name": "On False ANY",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-1760, 800]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json[\"value\"] }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "787d9236-d7eb-442b-afef-91e6066b925c",
|
||||
"name": "IF",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2000, 340]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "c46df596-7cec-4a67-a50c-240e992f5c4d",
|
||||
"name": "On True",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-1760, 260]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "86510ba2-8744-4383-b5a0-5c6b67625cd8",
|
||||
"name": "On False",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-1760, 420]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json[\"value\"] }}",
|
||||
"operation": "notEqual",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "2b031214-fff5-475b-88f9-a091a48bcc1e",
|
||||
"name": "IF Not Equal",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-1420, 520]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "da080483-32b2-429c-8d06-61e40a86c8d5",
|
||||
"name": "On True Not Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-1180, 420]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d373dd92-dede-4629-ab23-61e1dd89bc46",
|
||||
"name": "On False Not Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-1180, 600]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"On True": [
|
||||
{
|
||||
"json": {
|
||||
"value": true,
|
||||
"value2": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False": [
|
||||
{
|
||||
"json": {
|
||||
"value": false,
|
||||
"value2": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Not Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": false,
|
||||
"value2": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Not Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": true,
|
||||
"value2": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True ANY": [
|
||||
{
|
||||
"json": {
|
||||
"value": true,
|
||||
"value2": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"value": false,
|
||||
"value2": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF ANY",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF ANY": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True ANY",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False ANY",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Not Equal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"versionId": "5d748d36-ca05-4f7a-b253-70c42e5473ca",
|
||||
"id": "181",
|
||||
"meta": {
|
||||
"instanceId": "104a4d08d8897b8bdeb38aaca515021075e0bd8544c983c2bb8c86e6a8e6081c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
{
|
||||
"name": "If node unit tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "711fa21c-4ac2-4eed-9c35-a79edf18e8af",
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [140, 1560]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"dayOne": "2023-01-01T00:00:00.000-05:00",
|
||||
"dayTwo": "2023-01-02T00:00:00.000-05:00"
|
||||
},
|
||||
{
|
||||
"dayOne": "2023-01-02T00:00:00.000-05:00",
|
||||
"dayTwo": "2023-01-01T00:00:00.000-05:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "c5d906bc-909a-45d9-a990-9ea6279cc807",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [340, 1560]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"dateTime": [
|
||||
{
|
||||
"value1": "={{ $json.dayOne }}",
|
||||
"value2": "={{ $json.dayTwo }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "10431f40-d47d-4bd9-8dd6-d4dbb35d626b",
|
||||
"name": "IF Occured After",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [560, 1440]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "2727a2f7-2bda-469b-a548-8df82de433e2",
|
||||
"name": "On False Occured After",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [980, 1460]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "40baaffe-9769-4b15-b09f-3553e37f90a5",
|
||||
"name": "On True Occured After",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [760, 1420]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"dateTime": [
|
||||
{
|
||||
"value1": "={{ $json.dayOne }}",
|
||||
"operation": "before",
|
||||
"value2": "={{ $json.dayTwo }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "29ff421d-d7c5-4cc6-8830-73c0abf1c13f",
|
||||
"name": "IF Occured Before",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [560, 1680]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "3347b52a-e513-4900-ab9a-bbcc7a6ec063",
|
||||
"name": "On True Occured Before",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [760, 1660]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d8401e15-f6e5-4347-b885-54798494cb1b",
|
||||
"name": "On False Occured Before",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [980, 1700]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"On True Occured After": [
|
||||
{
|
||||
"json": {
|
||||
"dayOne": "2023-01-02T00:00:00.000-05:00",
|
||||
"dayTwo": "2023-01-01T00:00:00.000-05:00"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Occured After": [
|
||||
{
|
||||
"json": {
|
||||
"dayOne": "2023-01-01T00:00:00.000-05:00",
|
||||
"dayTwo": "2023-01-02T00:00:00.000-05:00"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Occured Before": [
|
||||
{
|
||||
"json": {
|
||||
"dayOne": "2023-01-01T00:00:00.000-05:00",
|
||||
"dayTwo": "2023-01-02T00:00:00.000-05:00"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Occured Before": [
|
||||
{
|
||||
"json": {
|
||||
"dayOne": "2023-01-02T00:00:00.000-05:00",
|
||||
"dayTwo": "2023-01-01T00:00:00.000-05:00"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF Occured After",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Occured Before",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Occured After": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Occured After",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Occured After",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Occured Before": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Occured Before",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Occured Before",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"versionId": "78121a47-2013-4f79-b0bd-b4d607dc82bf",
|
||||
"id": "181",
|
||||
"meta": {
|
||||
"instanceId": "104a4d08d8897b8bdeb38aaca515021075e0bd8544c983c2bb8c86e6a8e6081c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,557 @@
|
||||
{
|
||||
"name": "If node unit tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "11d2c2c8-5690-45e5-a863-8750191acaa7",
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-5180, 3020]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "77e63f88-e5fc-4662-af2e-6947a4768cf3",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [-4980, 3020]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"value2": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "861e29f8-ae3d-4a67-8367-5811b021c129",
|
||||
"name": "IF Smaller",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 2480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"operation": "smallerEqual",
|
||||
"value2": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "b5ac7784-9d70-4df9-8451-8157e8ff23e6",
|
||||
"name": "IF Smaller or Equal",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 2660]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "4f5336b3-de6d-4174-b186-f5040af0fa47",
|
||||
"name": "On True Smaller",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4560, 2460]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f5128cec-4faa-4408-9b00-68d995bd0723",
|
||||
"name": "On False Smaller",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4320, 2500]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "ccf77a6c-e168-4ca3-9ade-ac13d04016f6",
|
||||
"name": "On True Smaller or Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4560, 2640]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"operation": "equal",
|
||||
"value2": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "d276e794-56bc-4c7c-ab96-a2822ad75b3a",
|
||||
"name": "IF Equal",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 2840]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "bad938c1-2faf-4aef-8059-9d1a33257fbf",
|
||||
"name": "On True Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4560, 2820]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "8ff56c84-4a44-440c-a5cf-8659879b1bb3",
|
||||
"name": "On False Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4320, 2860]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"operation": "notEqual",
|
||||
"value2": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "bda97a18-aca7-437f-9920-96089067c43c",
|
||||
"name": "IF Not Equal",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 3020]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "7f3a01bd-24c5-43fd-bc1e-8087301f9745",
|
||||
"name": "On True Not Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4560, 3000]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f956db17-cd53-4222-94ed-100d91dc0c5a",
|
||||
"name": "On False Not Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4320, 3040]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"operation": "larger",
|
||||
"value2": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "eb01c8b7-43fb-4716-8247-69eabb47ff6b",
|
||||
"name": "IF Larger",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 3200]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "81b6e68d-2536-424d-908f-5bf6f4ee090d",
|
||||
"name": "On True Larger",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4560, 3180]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d7881e80-93bf-45ba-b831-02534daaa65f",
|
||||
"name": "On False Larger",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4320, 3220]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"operation": "largerEqual",
|
||||
"value2": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "e328bd99-269b-4f33-aed8-1d9c3289b0ec",
|
||||
"name": "IF Larger or Equal",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 3400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e673c174-15b9-4992-b870-6ba127890e47",
|
||||
"name": "On True Larger or Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4560, 3380]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"operation": "isEmpty"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "d42fa33b-2f5e-4c20-a48a-0a9bec2ad847",
|
||||
"name": "IF Is Empty",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 3600]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "c59fcd54-5b4f-4c68-9ead-8803ac1c9094",
|
||||
"name": "On False Is Empty",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4320, 3620]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.value }}",
|
||||
"operation": "isNotEmpty"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "c70d2625-996c-46a0-9c34-f2a1da4a29e5",
|
||||
"name": "IF Is Not Empty",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-4760, 3780]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "2430fb5e-8d25-4b70-a517-753e1e32f579",
|
||||
"name": "On True Is Not Empty",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-4560, 3760]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"On True Smaller": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Smaller": [
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Smaller or Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Not Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Not Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Larger": [
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Larger": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Larger or Equal": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Is Empty": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Is Not Empty": [
|
||||
{
|
||||
"json": {
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF Smaller",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Smaller or Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Larger",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Larger or Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Is Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Is Not Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Smaller": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Smaller",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Smaller",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Smaller or Equal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Smaller or Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Equal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Not Equal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Larger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Larger",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Larger",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Larger or Equal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Larger or Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Is Empty": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "On False Is Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Is Not Empty": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Is Not Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"versionId": "ec60bcbc-afef-4aae-91e2-65ffef88234b",
|
||||
"id": "181",
|
||||
"meta": {
|
||||
"instanceId": "104a4d08d8897b8bdeb38aaca515021075e0bd8544c983c2bb8c86e6a8e6081c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,875 @@
|
||||
{
|
||||
"name": "If node unit tests",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "38a682ce-6cde-4f90-bfd0-a80c61e2b22d",
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-3120, 600]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"name": "Elon Musk"
|
||||
},
|
||||
{
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "a35687af-99c1-43b2-aa43-955fcd87ff81",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [-2920, 600]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "466a0b11-7826-4ba9-9563-9ac5d6d08457",
|
||||
"name": "On True",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, -500]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "91363030-4550-4ee2-9dea-f3adad8c1190",
|
||||
"name": "On False",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, -460]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "contains",
|
||||
"value2": "Elon"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "93db20a4-9781-4de1-a298-87e885a21f31",
|
||||
"name": "IF Contains",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, -480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "notContains",
|
||||
"value2": "Elon"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "9f286ba6-f2a6-4aa1-895a-65992c1d5eae",
|
||||
"name": "IF Not Contains",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, -300]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "45be466f-da36-40da-993c-fb6f3de313e2",
|
||||
"name": "On True Contains",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, -320]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "578dc9f0-0224-475e-89bb-af8b474c5d4e",
|
||||
"name": "On False Contains",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, -280]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "endsWith",
|
||||
"value2": "Musk"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "715f2210-7dd0-47e9-bcd7-3a62728d993e",
|
||||
"name": "IF Ends With",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, -120]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "847291c1-3040-4289-a8f9-a23e82b8ff85",
|
||||
"name": "On True Ends With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, -140]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "bb312b9d-5bda-4869-a790-932a85374bf1",
|
||||
"name": "On False Ends With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, -100]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "1f507ed5-1602-40c0-ba3d-7b0095f1c346",
|
||||
"name": "On True Not Ends With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 20]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "notEndsWith",
|
||||
"value2": "Musk"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "c9423daa-de29-4f05-9dde-5b90006fe1a0",
|
||||
"name": "IF Not Ends With",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 40]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "ad89d258-3fc4-4f96-93f4-0c4c4d0b4aca",
|
||||
"name": "On False Not Ends With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 60]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"value2": "Elon Musk"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "ac91ef56-3bab-42db-b800-13f53be03a43",
|
||||
"name": "IF Equal",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 240]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "db00d63e-0e74-4d89-a8f4-4de3492fe5e6",
|
||||
"name": "On True Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 220]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "3314da40-e56a-4a6b-932e-8a31335f2535",
|
||||
"name": "On False Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 260]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "notEqual",
|
||||
"value2": "Elon Musk"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "765195fc-6cba-4918-89b8-ad5ca456e89e",
|
||||
"name": "IF Not Equal",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 420]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e720d65f-13f5-4888-ab14-8b022b2fc08e",
|
||||
"name": "On True Not Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f14a2032-b734-4f40-84a3-42426eec932e",
|
||||
"name": "On False Not Equal",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 440]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "regex",
|
||||
"value2": "([E])"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "caa56347-323c-4671-abae-71a0d6586315",
|
||||
"name": "IF Regex",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 600]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "5a83ee44-5b71-472d-8a6c-ee3fddd78482",
|
||||
"name": "On True Regex",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 580]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "a82388fc-6b93-4327-bb99-da6b0b0824cd",
|
||||
"name": "On False Regex",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 620]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "notRegex",
|
||||
"value2": "([E])"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "6139ed77-889d-4b89-8c2f-c26601ffb54a",
|
||||
"name": "IF Not Regex",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 780]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f61258e3-44aa-4fd5-9602-a135ad4a8e6b",
|
||||
"name": "On True Not Regex",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 760]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d547895d-5dd2-4fba-9076-dbd21db7559d",
|
||||
"name": "On False Not Regex",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 800]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "startsWith",
|
||||
"value2": "Elon"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "45ea72ae-6ee0-492f-9f6c-237b95c5516f",
|
||||
"name": "IF Starts With",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 980]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "7102319b-10d2-46af-a04f-84dcee678038",
|
||||
"name": "On True Starts With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 960]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "1f986310-a6b1-40a5-aff3-c595b414c3cd",
|
||||
"name": "On False Starts With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 1000]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "notStartsWith",
|
||||
"value2": "Elon"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "16513014-99f8-4d36-b5ef-1c8c28aa1d1d",
|
||||
"name": "IF Not Starts With",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 1180]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "31b15c96-9075-4892-baa1-683d7ce802d1",
|
||||
"name": "On True Not Starts With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 1160]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "33786edf-86af-4769-9fa2-f8ba78b67588",
|
||||
"name": "On False Not Starts With",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 1200]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "isEmpty"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "7e90e29c-186c-4c22-a7a9-e1a7a620a53f",
|
||||
"name": "IF Is Empty",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 1380]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "adde8115-8279-43e6-b5b3-211378ccb56a",
|
||||
"name": "On False Is Empty",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2220, 1400]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"operation": "isNotEmpty"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "2e0f102e-b1a0-42c3-a523-47095233b357",
|
||||
"name": "IF Is Not Empty",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [-2660, 1560]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "37a9085f-89e0-4b15-93a9-69f583330f2b",
|
||||
"name": "On True Is Not Empty",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [-2460, 1540]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"On True": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Contains": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Contains": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Ends With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Ends With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Not Ends With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Not Ends With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Equal": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Equal": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Not Equal": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Not Equal": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Regex": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Regex": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Not Regex": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Not Regex": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Starts With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Starts With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Not Starts With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Not Starts With": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On False Is Empty": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
],
|
||||
"On True Is Not Empty": [
|
||||
{
|
||||
"json": {
|
||||
"name": "Elon Musk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"name": "Arnold Schwarzenegger"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF Contains",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Not Contains",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Ends With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Not Ends With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Regex",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Not Regex",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Starts With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Not Starts With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Is Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "IF Is Not Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Contains": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Not Contains": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Contains",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Contains",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Ends With": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Ends With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Ends With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Not Ends With": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Not Ends With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Not Ends With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Equal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Not Equal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Not Equal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Regex": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Regex",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Regex",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Not Regex": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Not Regex",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Not Regex",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Starts With": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Starts With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Starts With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Not Starts With": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Not Starts With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "On False Not Starts With",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Is Empty": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "On False Is Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF Is Not Empty": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "On True Is Not Empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"versionId": "76683cf0-dd49-4220-b196-88d8b37c7207",
|
||||
"id": "181",
|
||||
"meta": {
|
||||
"instanceId": "104a4d08d8897b8bdeb38aaca515021075e0bd8544c983c2bb8c86e6a8e6081c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
describe('Test IF Node', () => {
|
||||
new NodeTestHarness().setupTests();
|
||||
});
|
||||
@@ -0,0 +1,180 @@
|
||||
{
|
||||
"name": "Filter test: boolean",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "9e2c2dc5-bd37-460b-a5a4-943860dcc03e",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-720, 160]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "3184fda2-b1d0-400a-a882-5844bbe99ae3",
|
||||
"name": "false",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 260]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"email": "shane@yahoo.com",
|
||||
"admin": false
|
||||
},
|
||||
{
|
||||
"email": "sharon@yahoo.com",
|
||||
"admin": true
|
||||
},
|
||||
{
|
||||
"email": "sarah@gmail.com",
|
||||
"admin": "false"
|
||||
},
|
||||
{
|
||||
"email": "tom@gmail.com",
|
||||
"admin": "0"
|
||||
},
|
||||
{
|
||||
"email": "jane@gmail.com",
|
||||
"admin": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "85de5f5c-0a4c-4da1-805b-9e056089bcd5",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [-500, 160]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "8577ab3b-b9f8-4c4d-a3a1-abb6a9269473",
|
||||
"name": "true",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 100]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "loose",
|
||||
"version": 2
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "307e4ea0-3a82-4722-aca6-68d882115e8b",
|
||||
"leftValue": "={{ $json.admin }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"looseTypeValidation": true,
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.2,
|
||||
"position": [-280, 160],
|
||||
"id": "d5d17556-45e6-44a1-8580-a08395ca38c4",
|
||||
"name": "loose"
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"true": [
|
||||
{
|
||||
"json": {
|
||||
"email": "sharon@yahoo.com",
|
||||
"admin": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "jane@gmail.com",
|
||||
"admin": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"json": {
|
||||
"email": "shane@yahoo.com",
|
||||
"admin": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "sarah@gmail.com",
|
||||
"admin": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "tom@gmail.com",
|
||||
"admin": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "loose",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"loose": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "true",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "false",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "35631b37-dc5e-4155-a54f-41b38584f38e",
|
||||
"meta": {
|
||||
"instanceId": "27cc9b56542ad45b38725555722c50a1c3fee1670bbb67980558314ee08517c4"
|
||||
},
|
||||
"id": "JQsdJ4gnZtuDb7Oo",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f332a7d1-31b4-4e78-b31e-9e8db945bf3f",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-60, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"date": "2023-10-26T16:45:52.367Z",
|
||||
"label": "Apple"
|
||||
},
|
||||
{
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Banana"
|
||||
},
|
||||
{
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Kiwi"
|
||||
},
|
||||
{
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Orange"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "60697c7f-3948-4790-97ba-8aba03d02ac2",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [160, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.date }}",
|
||||
"rightValue": "2023-10-21",
|
||||
"operator": {
|
||||
"type": "dateTime",
|
||||
"operation": "before"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "or"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7531191b-5ac3-45dc-8afb-27ae83d8f33a",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [380, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d8c614ea-0bbf-4b12-ad7d-c9ebe09ce583",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "69364770-60d2-4ef4-9f29-9570718a9a10",
|
||||
"name": "Else",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 580]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Banana"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Kiwi"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-20T16:45:52.367Z",
|
||||
"label": "Orange"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Else": [
|
||||
{
|
||||
"json": {
|
||||
"date": "2023-10-26T16:45:52.367Z",
|
||||
"label": "Apple"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Else",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "ce7ed9ae-704e-4da8-b178-24556f720b2a",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import get from 'lodash/get';
|
||||
import {
|
||||
NodeOperationError,
|
||||
type IExecuteFunctions,
|
||||
type INodeTypeDescription,
|
||||
type IDataObject,
|
||||
type IGetNodeParameterOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import * as IfV2 from '../../V2/IfV2.node';
|
||||
|
||||
jest.mock('lodash/set', () => jest.fn());
|
||||
|
||||
describe('Test IF v2 Node Tests', () => {
|
||||
afterEach(() => jest.resetAllMocks());
|
||||
|
||||
describe('Test IF v2 Node Workflow Tests', () => {
|
||||
new NodeTestHarness().setupTests();
|
||||
});
|
||||
|
||||
describe('Test IF V2 Node Unit Tests', () => {
|
||||
const node = new IfV2.IfV2(mock<INodeTypeDescription>());
|
||||
|
||||
const input = [{ json: {} }];
|
||||
|
||||
const createMockExecuteFunction = (
|
||||
nodeParameters: IDataObject,
|
||||
continueOnFail: boolean = false,
|
||||
) => {
|
||||
const fakeExecuteFunction = {
|
||||
getNodeParameter(
|
||||
parameterName: string,
|
||||
itemIndex: number,
|
||||
fallbackValue?: IDataObject,
|
||||
options?: IGetNodeParameterOptions,
|
||||
) {
|
||||
const parameter = options?.extractValue ? `${parameterName}.value` : parameterName;
|
||||
|
||||
const parameterValue = get(nodeParameters, parameter, fallbackValue);
|
||||
|
||||
if ((parameterValue as IDataObject)?.nodeOperationError) {
|
||||
throw new NodeOperationError(mock(), 'Get Options Error', { itemIndex });
|
||||
}
|
||||
|
||||
return parameterValue;
|
||||
},
|
||||
getNode() {
|
||||
return node;
|
||||
},
|
||||
continueOnFail: () => continueOnFail,
|
||||
getInputData: () => input,
|
||||
} as unknown as IExecuteFunctions;
|
||||
return fakeExecuteFunction;
|
||||
};
|
||||
|
||||
it('should return items if continue on fail is true', async () => {
|
||||
const fakeExecuteFunction = createMockExecuteFunction(
|
||||
{ options: { nodeOperationError: true } },
|
||||
true,
|
||||
);
|
||||
|
||||
const output = await node.execute.call(fakeExecuteFunction);
|
||||
expect(output).toEqual([[], input]);
|
||||
});
|
||||
|
||||
it('should throw an error if continue on fail is false and if there is an error', async () => {
|
||||
const fakeExecuteFunction = createMockExecuteFunction(
|
||||
{ options: { nodeOperationError: true } },
|
||||
false,
|
||||
);
|
||||
|
||||
await expect(node.execute.call(fakeExecuteFunction)).rejects.toThrow(NodeOperationError);
|
||||
});
|
||||
|
||||
it('should assign a paired item if paired item is undefined', async () => {
|
||||
const fakeExecuteFunction = createMockExecuteFunction(
|
||||
{ options: {}, conditions: true },
|
||||
false,
|
||||
);
|
||||
|
||||
const output = await node.execute.call(fakeExecuteFunction);
|
||||
expect(output).toEqual([[], [{ json: {}, pairedItem: { item: 0 } }]]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,163 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f332a7d1-31b4-4e78-b31e-9e8db945bf3f",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-60, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"count": 1,
|
||||
"label": "Apple"
|
||||
},
|
||||
{
|
||||
"count": 5,
|
||||
"label": "Banana"
|
||||
},
|
||||
{
|
||||
"count": 12,
|
||||
"label": "Kiwi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "60697c7f-3948-4790-97ba-8aba03d02ac2",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [160, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.count }}",
|
||||
"rightValue": "1",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "equals"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.count }}",
|
||||
"rightValue": "10",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "gt"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "or"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7531191b-5ac3-45dc-8afb-27ae83d8f33a",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [380, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d8c614ea-0bbf-4b12-ad7d-c9ebe09ce583",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "69364770-60d2-4ef4-9f29-9570718a9a10",
|
||||
"name": "Else",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 580]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"count": 1,
|
||||
"label": "Apple"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"count": 12,
|
||||
"label": "Kiwi"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Else": [
|
||||
{
|
||||
"json": {
|
||||
"count": 5,
|
||||
"label": "Banana"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Else",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "78d54316-4f39-4012-bbb8-c789f1f8865b",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f332a7d1-31b4-4e78-b31e-9e8db945bf3f",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-60, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"label": "Apple",
|
||||
"tags": [],
|
||||
"meta": {
|
||||
"foo": "bar"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Banana",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
},
|
||||
{
|
||||
"label": "Kiwi",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
},
|
||||
{
|
||||
"label": "Orange",
|
||||
"meta": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "60697c7f-3948-4790-97ba-8aba03d02ac2",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [160, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.tags }}",
|
||||
"rightValue": "exotic",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "contains",
|
||||
"rightType": "any"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.meta }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "object",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "or"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7531191b-5ac3-45dc-8afb-27ae83d8f33a",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [380, 480]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "d8c614ea-0bbf-4b12-ad7d-c9ebe09ce583",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "69364770-60d2-4ef4-9f29-9570718a9a10",
|
||||
"name": "Else",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 580]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"label": "Apple",
|
||||
"tags": [],
|
||||
"meta": {
|
||||
"foo": "bar"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"label": "Banana",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"label": "Kiwi",
|
||||
"tags": ["exotic"],
|
||||
"meta": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Else": [
|
||||
{
|
||||
"json": {
|
||||
"label": "Orange",
|
||||
"meta": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Else",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "a6249f48-d88f-4b80-9ed9-79555e522d48",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"name": "Filter test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "96490c63-a3f4-4923-b969-8f9adcbb1bbb",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-160, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": false,
|
||||
"leftValue": ""
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.firstname }}",
|
||||
"rightValue": "s",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "startsWith"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.lastname }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "any",
|
||||
"operation": "exists"
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftValue": "={{ $json.email }}",
|
||||
"rightValue": "@yahoo.com",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "endsWith"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {
|
||||
"caseSensitive": false
|
||||
}
|
||||
},
|
||||
"id": "48399b31-219a-42fa-bb5b-380dbb4a2e7d",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [260, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "8a59a941-bafd-46a6-8692-878de715d912",
|
||||
"name": "false",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [560, 440]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "b82546fa-f9e9-4fa3-9dcb-e2c94a3784de",
|
||||
"name": "Then",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [560, 140]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"data": [
|
||||
{
|
||||
"email": "Shane@yahoo.com",
|
||||
"firstname": "Shane",
|
||||
"lastname": "Martin"
|
||||
},
|
||||
{
|
||||
"email": "Sharon@yahoo.com",
|
||||
"firstname": "Sharon",
|
||||
"lastname": "Tromp"
|
||||
},
|
||||
{
|
||||
"email": "sarah@gmail.com",
|
||||
"firstname": "Sarah",
|
||||
"lastname": "Dawson"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "674c5688-ac03-49a7-83fb-62460a10cc10",
|
||||
"name": "Code",
|
||||
"type": "n8n-nodes-testing.testData",
|
||||
"typeVersion": 1,
|
||||
"position": [60, 300]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Then": [
|
||||
{
|
||||
"json": {
|
||||
"email": "Shane@yahoo.com",
|
||||
"firstname": "Shane",
|
||||
"lastname": "Martin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"email": "Sharon@yahoo.com",
|
||||
"firstname": "Sharon",
|
||||
"lastname": "Tromp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"json": {
|
||||
"email": "sarah@gmail.com",
|
||||
"firstname": "Sarah",
|
||||
"lastname": "Dawson"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Then",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "false",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "48c6a584-e79b-4ce4-ab4b-2b4ab663b89d",
|
||||
"id": "BWUTRs5RHxVgQ4uT",
|
||||
"meta": {
|
||||
"instanceId": "78577815012af39cf16dad7a787b0898c42fb7514b8a7f99b2136862c2af502c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user