import { GraphConfigData } from "@logicflow/core"; import LogicDataToTestData from "../LogicData_TestData"; import { expect, test } from "vitest"; import parse from "../parse"; const raw: GraphConfigData = { "nodes": [{ "id": "4292b0ae-d3aa-4704-88b6-1503bb185f34", "type": "ID", "x": 80, "y": 440, "properties": { "name": "n102", "nodeId": "n102" } }, { "id": "4b616c78-34cf-4dfb-a237-1fe98f6a21d1", "type": "IF", "x": 320, "y": 440, "properties": { "name": "n103", "nodeId": "n103" } }, { "id": "fbfa028e-8ae3-410f-a2fd-2d9f01803eab", "type": "ID", "x": 560, "y": 440, "properties": { "name": "n104", "nodeId": "n104" } }, { "id": "d8c2b9a8-502d-491e-913a-6580606e2c9e", "type": "ID", "x": 80, "y": 220, "properties": { "name": "n106", "nodeId": "n106" } }], "edges": [{ "id": "6a480b96-4ddd-4cf6-98b6-b430df4d7ac7", "type": "bezier", "sourceNodeId": "4b616c78-34cf-4dfb-a237-1fe98f6a21d1", "targetNodeId": "fbfa028e-8ae3-410f-a2fd-2d9f01803eab", "startPoint": { "x": 365, "y": 440 }, "endPoint": { "x": 515, "y": 440 }, "properties": {}, "pointsList": [{ "x": 365, "y": 440 }, { "x": 465, "y": 440 }, { "x": 415, "y": 440 }, { "x": 515, "y": 440 }] }, { "id": "405bc42e-9306-4e98-9c5c-8a1856f8ed31", "type": "bezier", "sourceNodeId": "4292b0ae-d3aa-4704-88b6-1503bb185f34", "targetNodeId": "4b616c78-34cf-4dfb-a237-1fe98f6a21d1", "startPoint": { "x": 125, "y": 440 }, "endPoint": { "x": 275, "y": 440 }, "properties": {}, "pointsList": [{ "x": 125, "y": 440 }, { "x": 225, "y": 440 }, { "x": 175, "y": 440 }, { "x": 275, "y": 440 }] }, { "id": "585e98b4-3030-4213-93ed-33f9e8e99c89", "type": "bezier", "sourceNodeId": "d8c2b9a8-502d-491e-913a-6580606e2c9e", "targetNodeId": "4292b0ae-d3aa-4704-88b6-1503bb185f34", "startPoint": { "x": 80, "y": 250 }, "endPoint": { "x": 80, "y": 410 }, "properties": {}, "pointsList": [{ "x": 80, "y": 250 }, { "x": 80, "y": 350 }, { "x": 80, "y": 310 }, { "x": 80, "y": 410 }] }] } const data = LogicDataToTestData(raw, `THEN( n106, n102, IF(n103,n104) )`) test("when chain", () => { expect(parse(data.input)).toBe(data.output); })