import { GraphConfigData } from "@logicflow/core"; import LogicDataToTestData from "../LogicData_TestData"; import { expect, test } from "vitest"; import parse from "../parse"; const raw: GraphConfigData = { "nodes": [{ "id": "f39ce833-2abb-484c-8881-2adcf0e08668", "type": "GROUP", "x": 880, "y": 540, "properties": { "isFolded": false, "nodeId": "n82", "name": "n82", "id": "f39ce833-2abb-484c-8881-2adcf0e08668", "groupType": "LOGIC", "groupAddable": false, "nodeSize": { "width": 267, "height": 170 } }, "children": ["03029cc4-dc85-4c81-ad12-ee1b7c0a9221", "c4dcd23a-6645-448b-989c-26d831ab265e", "f44e45bf-56c5-4b9d-89f0-7f4f7fbca798"], "flowData": { "nodes": [{ "id": "03029cc4-dc85-4c81-ad12-ee1b7c0a9221", "type": "ID", "x": 820, "y": 500, "properties": { "name": "n83", "nodeId": "n83" } }, { "id": "c4dcd23a-6645-448b-989c-26d831ab265e", "type": "ID", "x": 820, "y": 580, "properties": { "name": "n84", "nodeId": "n84" } }, { "id": "f44e45bf-56c5-4b9d-89f0-7f4f7fbca798", "type": "AND", "x": 960, "y": 540, "properties": { "name": "AND", "nodeId": "n85" } }], "edges": [{ "id": "ff673df4-4301-40b5-ad27-b7d0369df54d", "type": "bezier", "sourceNodeId": "03029cc4-dc85-4c81-ad12-ee1b7c0a9221", "targetNodeId": "f44e45bf-56c5-4b9d-89f0-7f4f7fbca798", "startPoint": { "x": 865, "y": 500 }, "endPoint": { "x": 915, "y": 540 }, "properties": {}, "pointsList": [{ "x": 865, "y": 500 }, { "x": 965, "y": 500 }, { "x": 815, "y": 540 }, { "x": 915, "y": 540 }] }, { "id": "8135e5ac-f56f-4636-9af6-47d2ebb56ab7", "type": "bezier", "sourceNodeId": "c4dcd23a-6645-448b-989c-26d831ab265e", "targetNodeId": "f44e45bf-56c5-4b9d-89f0-7f4f7fbca798", "startPoint": { "x": 865, "y": 580 }, "endPoint": { "x": 915, "y": 540 }, "properties": {}, "pointsList": [{ "x": 865, "y": 580 }, { "x": 965, "y": 580 }, { "x": 815, "y": 540 }, { "x": 915, "y": 540 }] }] } }, { "id": "03029cc4-dc85-4c81-ad12-ee1b7c0a9221", "type": "ID", "x": 820, "y": 500, "properties": { "name": "n83", "nodeId": "n83" } }, { "id": "c4dcd23a-6645-448b-989c-26d831ab265e", "type": "ID", "x": 820, "y": 580, "properties": { "name": "n84", "nodeId": "n84" } }, { "id": "f44e45bf-56c5-4b9d-89f0-7f4f7fbca798", "type": "AND", "x": 960, "y": 540, "properties": { "name": "AND", "nodeId": "n85" } }, { "id": "5bb738d2-2e04-4ac3-91c9-413acc1d5f87", "type": "ID", "x": 1180, "y": 480, "properties": { "name": "n86", "nodeId": "n86" } }, { "id": "c7ccf47b-c319-4c3e-acbb-1865d872b25c", "type": "ID", "x": 1180, "y": 600, "properties": { "name": "n87", "nodeId": "n87" } }], "edges": [{ "id": "ff673df4-4301-40b5-ad27-b7d0369df54d", "type": "bezier", "sourceNodeId": "03029cc4-dc85-4c81-ad12-ee1b7c0a9221", "targetNodeId": "f44e45bf-56c5-4b9d-89f0-7f4f7fbca798", "startPoint": { "x": 865, "y": 500 }, "endPoint": { "x": 915, "y": 540 }, "properties": {}, "pointsList": [{ "x": 865, "y": 500 }, { "x": 965, "y": 500 }, { "x": 815, "y": 540 }, { "x": 915, "y": 540 }] }, { "id": "8135e5ac-f56f-4636-9af6-47d2ebb56ab7", "type": "bezier", "sourceNodeId": "c4dcd23a-6645-448b-989c-26d831ab265e", "targetNodeId": "f44e45bf-56c5-4b9d-89f0-7f4f7fbca798", "startPoint": { "x": 865, "y": 580 }, "endPoint": { "x": 915, "y": 540 }, "properties": {}, "pointsList": [{ "x": 865, "y": 580 }, { "x": 965, "y": 580 }, { "x": 815, "y": 540 }, { "x": 915, "y": 540 }] }, { "id": "fe3efa79-8ff7-4cdf-9c19-a64fe978d918", "type": "bezier", "sourceNodeId": "f39ce833-2abb-484c-8881-2adcf0e08668", "targetNodeId": "5bb738d2-2e04-4ac3-91c9-413acc1d5f87", "startPoint": { "x": 1017, "y": 535 }, "endPoint": { "x": 1135, "y": 480 }, "properties": {}, "pointsList": [{ "x": 1017, "y": 535 }, { "x": 1117, "y": 535 }, { "x": 1035, "y": 480 }, { "x": 1135, "y": 480 }] }, { "id": "d85b2f2c-2084-437f-a0aa-6a3372fe9b08", "type": "bezier", "sourceNodeId": "f39ce833-2abb-484c-8881-2adcf0e08668", "targetNodeId": "c7ccf47b-c319-4c3e-acbb-1865d872b25c", "startPoint": { "x": 1017, "y": 535 }, "endPoint": { "x": 1135, "y": 600 }, "properties": {}, "pointsList": [{ "x": 1017, "y": 535 }, { "x": 1117, "y": 535 }, { "x": 1035, "y": 600 }, { "x": 1135, "y": 600 }] }] } const data = LogicDataToTestData(raw, "IF(AND(n83,n84),n86,n87)") test("when chain", () => { expect(parse(data.input)).toBe(data.output); })