import { expect, test } from 'vitest'; import { TestData } from '../type'; import parse from '../parse'; const data: TestData = { "input": { "nodes": [{ "id": "645a2306-40dd-4fc6-bc4a-a599809acb3d", "type": "ID", "x": 400, "y": 640, "properties": { "name": "n26", "nodeId": "n26" } }, { "id": "43bf2fc2-8800-4bd3-a2a2-73a81207fa7e", "type": "IF", "x": 220, "y": 680, "properties": { "name": "n27", "nodeId": "n27" } }, { "id": "216d0fa9-a9d5-49c0-b381-0d2a9eafc05e", "type": "ID", "x": 400, "y": 740, "properties": { "name": "n28", "nodeId": "n28" } }, { "id": "f629dc48-3678-4263-b64b-032a9ec17c9f", "type": "ID", "x": 580, "y": 740, "properties": { "name": "n29", "nodeId": "n29" } }, { "id": "625073fc-c707-4301-9eb7-7698c604f957", "type": "ID", "x": 400, "y": 840, "properties": { "name": "n30", "nodeId": "n30" } }], "edges": [{ "id": "b92a6065-9349-4e20-9af4-668d56e4d67a", "type": "bezier", "sourceNodeId": "43bf2fc2-8800-4bd3-a2a2-73a81207fa7e", "targetNodeId": "645a2306-40dd-4fc6-bc4a-a599809acb3d", "startPoint": { "x": 265, "y": 680 }, "endPoint": { "x": 355, "y": 640 }, "properties": {}, "pointsList": [{ "x": 265, "y": 680 }, { "x": 365, "y": 680 }, { "x": 255, "y": 640 }, { "x": 355, "y": 640 }] }, { "id": "061fac13-1893-4c72-a5a7-47c571b46a91", "type": "bezier", "sourceNodeId": "43bf2fc2-8800-4bd3-a2a2-73a81207fa7e", "targetNodeId": "216d0fa9-a9d5-49c0-b381-0d2a9eafc05e", "startPoint": { "x": 265, "y": 680 }, "endPoint": { "x": 355, "y": 740 }, "properties": {}, "pointsList": [{ "x": 265, "y": 680 }, { "x": 365, "y": 680 }, { "x": 255, "y": 740 }, { "x": 355, "y": 740 }] }, { "id": "d38cba6f-d5cf-4d79-a658-dd5742f59559", "type": "bezier", "sourceNodeId": "645a2306-40dd-4fc6-bc4a-a599809acb3d", "targetNodeId": "f629dc48-3678-4263-b64b-032a9ec17c9f", "startPoint": { "x": 445, "y": 640 }, "endPoint": { "x": 535, "y": 740 }, "properties": {}, "pointsList": [{ "x": 445, "y": 640 }, { "x": 545, "y": 640 }, { "x": 435, "y": 740 }, { "x": 535, "y": 740 }] }, { "id": "98d99f33-ef6a-421e-8d7e-3ccea4ed7c21", "type": "bezier", "sourceNodeId": "216d0fa9-a9d5-49c0-b381-0d2a9eafc05e", "targetNodeId": "f629dc48-3678-4263-b64b-032a9ec17c9f", "startPoint": { "x": 445, "y": 740 }, "endPoint": { "x": 535, "y": 740 }, "properties": {}, "pointsList": [{ "x": 445, "y": 740 }, { "x": 545, "y": 740 }, { "x": 435, "y": 740 }, { "x": 535, "y": 740 }] }, { "id": "d49ee383-33a4-41c0-a94a-8ff8f05e9716", "type": "bezier", "sourceNodeId": "625073fc-c707-4301-9eb7-7698c604f957", "targetNodeId": "f629dc48-3678-4263-b64b-032a9ec17c9f", "startPoint": { "x": 445, "y": 840 }, "endPoint": { "x": 535, "y": 740 }, "properties": {}, "pointsList": [{ "x": 445, "y": 840 }, { "x": 545, "y": 840 }, { "x": 435, "y": 740 }, { "x": 535, "y": 740 }] }] }, "output": `THEN( WHEN( IF(n27,n26,n28), n30 ), n29 )` } test("empty", () => { expect(parse(data.input)).toBe(data.output); })