import { GraphConfigData } from "@logicflow/core"; import LogicDataToTestData from "../LogicData_TestData"; import { expect, test } from "vitest"; import parse from "../parse"; const raw: GraphConfigData = { "nodes": [{ "id": "261970f5-1e3f-400a-a785-eb48e889dc13", "type": "GROUP", "x": 620, "y": 520, "properties": { "isFolded": false, "nodeId": "n93", "name": "n93", "id": "261970f5-1e3f-400a-a785-eb48e889dc13", "groupType": "WHILE", "nodeSize": { "width": 340, "height": 191 }, "groupAddable": false }, "children": ["73dcb02b-6b18-4a4c-b227-022209f71425"], "flowData": { "nodes": [{ "id": "73dcb02b-6b18-4a4c-b227-022209f71425", "type": "ID", "x": 640, "y": 540, "properties": { "name": "n95", "nodeId": "n95" } }], "edges": [] } }, { "id": "73dcb02b-6b18-4a4c-b227-022209f71425", "type": "ID", "x": 640, "y": 540, "properties": { "name": "n95", "nodeId": "n95" } }, { "id": "2a122047-409f-4b3f-9280-6d89ae0e7f14", "type": "GROUP", "x": 620, "y": 260, "properties": { "isFolded": false, "nodeId": "n96", "name": "n96", "nodeSize": { "width": 372, "height": 188 }, "groupAddable": false, "id": "2a122047-409f-4b3f-9280-6d89ae0e7f14", "groupType": "LOGIC" }, "children": ["57dd87d2-6e40-4e41-94c3-48dadef3ef6a", "b5db45af-38b8-4b54-b8ba-1b919fad028d", "bb6deb20-b52a-4c0c-b5cb-30b9b734e65e"], "flowData": { "nodes": [{ "id": "57dd87d2-6e40-4e41-94c3-48dadef3ef6a", "type": "ID", "x": 520, "y": 220, "properties": { "name": "n97", "nodeId": "n97" } }, { "id": "b5db45af-38b8-4b54-b8ba-1b919fad028d", "type": "ID", "x": 520, "y": 300, "properties": { "name": "n98", "nodeId": "n98" } }, { "id": "bb6deb20-b52a-4c0c-b5cb-30b9b734e65e", "type": "AND", "x": 700, "y": 260, "properties": { "name": "AND", "nodeId": "n99" } }], "edges": [{ "id": "2511b231-5fc0-4602-8d71-1baa156f167e", "type": "bezier", "sourceNodeId": "57dd87d2-6e40-4e41-94c3-48dadef3ef6a", "targetNodeId": "bb6deb20-b52a-4c0c-b5cb-30b9b734e65e", "startPoint": { "x": 565, "y": 220 }, "endPoint": { "x": 655, "y": 260 }, "properties": {}, "pointsList": [{ "x": 565, "y": 220 }, { "x": 665, "y": 220 }, { "x": 555, "y": 260 }, { "x": 655, "y": 260 }] }, { "id": "ae138a7f-f46f-45dc-b428-e9f9a7209b41", "type": "bezier", "sourceNodeId": "b5db45af-38b8-4b54-b8ba-1b919fad028d", "targetNodeId": "bb6deb20-b52a-4c0c-b5cb-30b9b734e65e", "startPoint": { "x": 565, "y": 300 }, "endPoint": { "x": 655, "y": 260 }, "properties": {}, "pointsList": [{ "x": 565, "y": 300 }, { "x": 665, "y": 300 }, { "x": 555, "y": 260 }, { "x": 655, "y": 260 }] }] } }, { "id": "57dd87d2-6e40-4e41-94c3-48dadef3ef6a", "type": "ID", "x": 520, "y": 220, "properties": { "name": "n97", "nodeId": "n97" } }, { "id": "b5db45af-38b8-4b54-b8ba-1b919fad028d", "type": "ID", "x": 520, "y": 300, "properties": { "name": "n98", "nodeId": "n98" } }, { "id": "bb6deb20-b52a-4c0c-b5cb-30b9b734e65e", "type": "AND", "x": 700, "y": 260, "properties": { "name": "AND", "nodeId": "n99" } }], "edges": [{ "id": "2511b231-5fc0-4602-8d71-1baa156f167e", "type": "bezier", "sourceNodeId": "57dd87d2-6e40-4e41-94c3-48dadef3ef6a", "targetNodeId": "bb6deb20-b52a-4c0c-b5cb-30b9b734e65e", "startPoint": { "x": 565, "y": 220 }, "endPoint": { "x": 655, "y": 260 }, "properties": {}, "pointsList": [{ "x": 565, "y": 220 }, { "x": 665, "y": 220 }, { "x": 555, "y": 260 }, { "x": 655, "y": 260 }] }, { "id": "ae138a7f-f46f-45dc-b428-e9f9a7209b41", "type": "bezier", "sourceNodeId": "b5db45af-38b8-4b54-b8ba-1b919fad028d", "targetNodeId": "bb6deb20-b52a-4c0c-b5cb-30b9b734e65e", "startPoint": { "x": 565, "y": 300 }, "endPoint": { "x": 655, "y": 260 }, "properties": {}, "pointsList": [{ "x": 565, "y": 300 }, { "x": 665, "y": 300 }, { "x": 555, "y": 260 }, { "x": 655, "y": 260 }] }, { "id": "4ac9fda3-2e85-4385-a498-60ddec9e7e53", "type": "bezier", "sourceNodeId": "261970f5-1e3f-400a-a785-eb48e889dc13", "targetNodeId": "2a122047-409f-4b3f-9280-6d89ae0e7f14", "startPoint": { "x": 620, "y": 424.5 }, "endPoint": { "x": 620, "y": 354 }, "properties": {}, "text": { "x": 620, "y": 389.25, "value": "START" } }] } const data = LogicDataToTestData(raw, "WHILE(AND(n97,n98)).DO(n95)") test("while-logic chain", () => { expect(parse(data.input)).toBe(data.output); })