import {ChunkType} from "../chunks/types/ChunkType"; import {NodeImplChunk} from "../chunks/types/NodeImplChunk"; import {nodeImplChunkToStructureNodeDef} from "./nodeImplChunkToStructureNodeDef"; describe("nodeImplChunkToStructureNodeDef()", () => { describe("for standalone child chunks", () => { it("should convert child chunks to child node properties", () => { const structureNodeImplChunk: NodeImplChunk = { "offset": { "line": 28, "column": 2 }, "type": ChunkType.NodeImpl, "children": [ { "offset": { "line": 29, "column": 4 }, "type": ChunkType.ChildNode, "children": [ { "offset": { "line": 30, "column": 6 }, "type": ChunkType.NodeParam, "captures": [ "param (fields) = [\"a\", \"b\"]", { "type": ChunkType.VarAssignment, "captures": [ "(fields) = [\"a\", \"b\"]", { "type": ChunkType.Identifier, "captures": [ "(fields)" ], "offset": { "line": 30, "column": 6 } }, { "type": ChunkType.Any, "captures": [ "[\"a\", \"b\"]" ], "offset": { "line": 30, "column": 6 } } ], "offset": { "line": 30, "column": 6 } } ] } ], "content": "param (fields) = [\"a\", \"b\"]", "captures": [ "child (sync a & b):(core).(Syncer)", { "type": ChunkType.NodeDecl, "captures": [ "(sync a & b):(core).(Syncer)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 29, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(Syncer)" ], "offset": { "line": 29, "column": 4 } } ], "offset": { "line": 29, "column": 4 } } ] }, { "offset": { "line": 31, "column": 4 }, "type": ChunkType.ChildNode, "captures": [ "child (and synced):(And [internal])", { "type": ChunkType.NodeDecl, "captures": [ "(and synced):(And [internal])", { "type": ChunkType.Identifier, "captures": [ "(and synced)" ], "offset": { "line": 31, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(And [internal])" ], "offset": { "line": 31, "column": 4 } } ], "offset": { "line": 31, "column": 4 } } ] }, { "offset": { "line": 32, "column": 4 }, "type": ChunkType.Connection, "captures": [ "connect (sync a & b).out.(synced) and (and synced).in.(a & b)", { "type": ChunkType.ConnectionBody, "captures": [ "(sync a & b).out.(synced) and (and synced).in.(a & b)", { "type": ChunkType.ChildPort, "captures": [ "(sync a & b).out.(synced)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(synced)" ], "offset": { "line": 32, "column": 4 } } ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.ChildPort, "captures": [ "(and synced).in.(a & b)", { "type": ChunkType.Identifier, "captures": [ "(and synced)" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a & b)" ], "offset": { "line": 32, "column": 4 } } ], "offset": { "line": 32, "column": 4 } } ], "offset": { "line": 32, "column": 4 } } ] }, { "offset": { "line": 33, "column": 4 }, "type": ChunkType.PortExposure, "captures": [ "expose (sync a & b).in.(a) as (a)", { "type": ChunkType.PortExposureBody, "captures": [ "(sync a & b).in.(a) as (a)", { "type": ChunkType.ChildPort, "captures": [ "(sync a & b).in.(a)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 33, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 33, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a)" ], "offset": { "line": 33, "column": 4 } } ], "offset": { "line": 33, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a)" ], "offset": { "line": 33, "column": 4 } } ], "offset": { "line": 33, "column": 4 } } ] }, { "offset": { "line": 34, "column": 4 }, "type": ChunkType.PortExposure, "captures": [ "expose (sync a & b).in.(b) as (b)", { "type": ChunkType.PortExposureBody, "captures": [ "(sync a & b).in.(b) as (b)", { "type": ChunkType.ChildPort, "captures": [ "(sync a & b).in.(b)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 34, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 34, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(b)" ], "offset": { "line": 34, "column": 4 } } ], "offset": { "line": 34, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(b)" ], "offset": { "line": 34, "column": 4 } } ], "offset": { "line": 34, "column": 4 } } ] }, { "offset": { "line": 35, "column": 4 }, "type": ChunkType.PortExposure, "captures": [ "expose (and synced).out.(a & b) as (result)", { "type": ChunkType.PortExposureBody, "captures": [ "(and synced).out.(a & b) as (result)", { "type": ChunkType.ChildPort, "captures": [ "(and synced).out.(a & b)", { "type": ChunkType.Identifier, "captures": [ "(and synced)" ], "offset": { "line": 35, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 35, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a & b)" ], "offset": { "line": 35, "column": 4 } } ], "offset": { "line": 35, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(result)" ], "offset": { "line": 35, "column": 4 } } ], "offset": { "line": 35, "column": 4 } } ] } ], "content": "child (sync a & b):(core).(Syncer)\n param (fields) = [\"a\", \"b\"]\nchild (and synced):(And [internal])\nconnect (sync a & b).out.(synced) and (and synced).in.(a & b)\nexpose (sync a & b).in.(a) as (a)\nexpose (sync a & b).in.(b) as (b)\nexpose (and synced).out.(a & b) as (result)", "captures": [ "in all", { "type": ChunkType.BuiltinTarget, "captures": [ "all" ], "offset": { "line": 28, "column": 2 } }, null ] }; const result = nodeImplChunkToStructureNodeDef(structureNodeImplChunk); expect(result).toMatchSnapshot(); }); }); describe("for grouped child chunks", () => { it("should convert child group chunk to child node parameters", () => { const structureNodeImplChunk: NodeImplChunk = { "offset": { "line": 10, "column": 2 }, "type": ChunkType.NodeImpl, "children": [ { "offset": { "line": 11, "column": 4 }, "type": ChunkType.ChildNodes, "children": [ { "offset": { "line": 12, "column": 6 }, "type": ChunkType.ChildNodesItem, "captures": [ "(start program):(core).(Start)", { "type": ChunkType.NodeDecl, "captures": [ "(start program):(core).(Start)", { "type": ChunkType.Identifier, "captures": [ "(start program)" ], "offset": { "line": 12, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(Start)" ], "offset": { "line": 12, "column": 6 } } ], "offset": { "line": 12, "column": 6 } } ] }, { "offset": { "line": 13, "column": 6 }, "type": ChunkType.ChildNodesItem, "children": [ { "offset": { "line": 14, "column": 8 }, "type": ChunkType.NodeParam, "captures": [ "param (value) = \"Hello, World!\"", { "type": ChunkType.VarAssignment, "captures": [ "(value) = \"Hello, World!\"", { "type": ChunkType.Identifier, "captures": [ "(value)" ], "offset": { "line": 14, "column": 8 } }, { "type": ChunkType.Any, "captures": [ "\"Hello, World!\"" ], "offset": { "line": 14, "column": 8 } } ], "offset": { "line": 14, "column": 8 } } ] } ], "content": "param (value) = \"Hello, World!\"", "captures": [ "(send \"Hello, World!\"):(core).(Value)", { "type": ChunkType.NodeDecl, "captures": [ "(send \"Hello, World!\"):(core).(Value)", { "type": ChunkType.Identifier, "captures": [ "(send \"Hello, World!\")" ], "offset": { "line": 13, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(Value)" ], "offset": { "line": 13, "column": 6 } } ], "offset": { "line": 13, "column": 6 } } ] }, { "offset": { "line": 15, "column": 6 }, "type": ChunkType.ChildNodesItem, "captures": [ "(log to console):(console).(Console Log)", { "type": ChunkType.NodeDecl, "captures": [ "(log to console):(console).(Console Log)", { "type": ChunkType.Identifier, "captures": [ "(log to console)" ], "offset": { "line": 15, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(Console Log)" ], "offset": { "line": 15, "column": 6 } } ], "offset": { "line": 15, "column": 6 } } ] } ], "content": "(start program):(core).(Start)\n(send \"Hello, World!\"):(core).(Value)\n param (value) = \"Hello, World!\"\n(log to console):(console).(Console Log)", "captures": [ "children" ] }, { "offset": { "line": 16, "column": 4 }, "type": ChunkType.Connections, "children": [ { "offset": { "line": 17, "column": 6 }, "type": ChunkType.ConnectionsItem, "captures": [ "(start program).out.(start) and (send \"Hello, World!\").in.(start)", { "type": ChunkType.ConnectionBody, "captures": [ "(start program).out.(start) and (send \"Hello, World!\").in.(start)", { "type": ChunkType.ChildPort, "captures": [ "(start program).out.(start)", { "type": ChunkType.Identifier, "captures": [ "(start program)" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(start)" ], "offset": { "line": 17, "column": 6 } } ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.ChildPort, "captures": [ "(send \"Hello, World!\").in.(start)", { "type": ChunkType.Identifier, "captures": [ "(send \"Hello, World!\")" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(start)" ], "offset": { "line": 17, "column": 6 } } ], "offset": { "line": 17, "column": 6 } } ], "offset": { "line": 17, "column": 6 } } ] }, { "offset": { "line": 18, "column": 6 }, "type": ChunkType.ConnectionsItem, "captures": [ "(send \"Hello, World!\").out.(value) and (log to console).in.(value)", { "type": ChunkType.ConnectionBody, "captures": [ "(send \"Hello, World!\").out.(value) and (log to console).in.(value)", { "type": ChunkType.ChildPort, "captures": [ "(send \"Hello, World!\").out.(value)", { "type": ChunkType.Identifier, "captures": [ "(send \"Hello, World!\")" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(value)" ], "offset": { "line": 18, "column": 6 } } ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.ChildPort, "captures": [ "(log to console).in.(value)", { "type": ChunkType.Identifier, "captures": [ "(log to console)" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(value)" ], "offset": { "line": 18, "column": 6 } } ], "offset": { "line": 18, "column": 6 } } ], "offset": { "line": 18, "column": 6 } } ] } ], "content": "(start program).out.(start) and (send \"Hello, World!\").in.(start)\n(send \"Hello, World!\").out.(value) and (log to console).in.(value)", "captures": [ "connect" ] } ], "content": "children\n (start program):(core).(Start)\n (send \"Hello, World!\"):(core).(Value)\n param (value) = \"Hello, World!\"\n (log to console):(console).(Console Log)\nconnect\n (start program).out.(start) and (send \"Hello, World!\").in.(start)\n (send \"Hello, World!\").out.(value) and (log to console).in.(value)", "captures": [ "in all", { "type": ChunkType.BuiltinTarget, "captures": [ "all" ], "offset": { "line": 10, "column": 2 } }, null ] }; const result = nodeImplChunkToStructureNodeDef(structureNodeImplChunk); expect(result).toMatchSnapshot(); }); }); describe("for standalone connection chunks", () => { it("should convert connection chunks to connections", () => { const structureNodeImplChunk: NodeImplChunk = { "offset": { "line": 28, "column": 2 }, "type": ChunkType.NodeImpl, "children": [ { "offset": { "line": 29, "column": 4 }, "type": ChunkType.ChildNode, "children": [ { "offset": { "line": 30, "column": 6 }, "type": ChunkType.NodeParam, "captures": [ "param (fields) = [\"a\", \"b\"]", { "type": ChunkType.VarAssignment, "captures": [ "(fields) = [\"a\", \"b\"]", { "type": ChunkType.Identifier, "captures": [ "(fields)" ], "offset": { "line": 30, "column": 6 } }, { "type": ChunkType.Any, "captures": [ "[\"a\", \"b\"]" ], "offset": { "line": 30, "column": 6 } } ], "offset": { "line": 30, "column": 6 } } ] } ], "content": "param (fields) = [\"a\", \"b\"]", "captures": [ "child (sync a & b):(core).(Syncer)", { "type": ChunkType.NodeDecl, "captures": [ "(sync a & b):(core).(Syncer)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 29, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(Syncer)" ], "offset": { "line": 29, "column": 4 } } ], "offset": { "line": 29, "column": 4 } } ] }, { "offset": { "line": 31, "column": 4 }, "type": ChunkType.ChildNode, "captures": [ "child (and synced):(And [internal])", { "type": ChunkType.NodeDecl, "captures": [ "(and synced):(And [internal])", { "type": ChunkType.Identifier, "captures": [ "(and synced)" ], "offset": { "line": 31, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(And [internal])" ], "offset": { "line": 31, "column": 4 } } ], "offset": { "line": 31, "column": 4 } } ] }, { "offset": { "line": 32, "column": 4 }, "type": ChunkType.Connection, "captures": [ "connect (sync a & b).out.(synced) and (and synced).in.(a & b)", { "type": ChunkType.ConnectionBody, "captures": [ "(sync a & b).out.(synced) and (and synced).in.(a & b)", { "type": ChunkType.ChildPort, "captures": [ "(sync a & b).out.(synced)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(synced)" ], "offset": { "line": 32, "column": 4 } } ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.ChildPort, "captures": [ "(and synced).in.(a & b)", { "type": ChunkType.Identifier, "captures": [ "(and synced)" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 32, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a & b)" ], "offset": { "line": 32, "column": 4 } } ], "offset": { "line": 32, "column": 4 } } ], "offset": { "line": 32, "column": 4 } } ] }, { "offset": { "line": 33, "column": 4 }, "type": ChunkType.PortExposure, "captures": [ "expose (sync a & b).in.(a) as (a)", { "type": ChunkType.PortExposureBody, "captures": [ "(sync a & b).in.(a) as (a)", { "type": ChunkType.ChildPort, "captures": [ "(sync a & b).in.(a)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 33, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 33, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a)" ], "offset": { "line": 33, "column": 4 } } ], "offset": { "line": 33, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a)" ], "offset": { "line": 33, "column": 4 } } ], "offset": { "line": 33, "column": 4 } } ] }, { "offset": { "line": 34, "column": 4 }, "type": ChunkType.PortExposure, "captures": [ "expose (sync a & b).in.(b) as (b)", { "type": ChunkType.PortExposureBody, "captures": [ "(sync a & b).in.(b) as (b)", { "type": ChunkType.ChildPort, "captures": [ "(sync a & b).in.(b)", { "type": ChunkType.Identifier, "captures": [ "(sync a & b)" ], "offset": { "line": 34, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 34, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(b)" ], "offset": { "line": 34, "column": 4 } } ], "offset": { "line": 34, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(b)" ], "offset": { "line": 34, "column": 4 } } ], "offset": { "line": 34, "column": 4 } } ] }, { "offset": { "line": 35, "column": 4 }, "type": ChunkType.PortExposure, "captures": [ "expose (and synced).out.(a & b) as (result)", { "type": ChunkType.PortExposureBody, "captures": [ "(and synced).out.(a & b) as (result)", { "type": ChunkType.ChildPort, "captures": [ "(and synced).out.(a & b)", { "type": ChunkType.Identifier, "captures": [ "(and synced)" ], "offset": { "line": 35, "column": 4 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 35, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(a & b)" ], "offset": { "line": 35, "column": 4 } } ], "offset": { "line": 35, "column": 4 } }, { "type": ChunkType.Identifier, "captures": [ "(result)" ], "offset": { "line": 35, "column": 4 } } ], "offset": { "line": 35, "column": 4 } } ] } ], "content": "child (sync a & b):(core).(Syncer)\n param (fields) = [\"a\", \"b\"]\nchild (and synced):(And [internal])\nconnect (sync a & b).out.(synced) and (and synced).in.(a & b)\nexpose (sync a & b).in.(a) as (a)\nexpose (sync a & b).in.(b) as (b)\nexpose (and synced).out.(a & b) as (result)", "captures": [ "in all", { "type": ChunkType.BuiltinTarget, "captures": [ "all" ], "offset": { "line": 28, "column": 2 } }, null ] }; const result = nodeImplChunkToStructureNodeDef(structureNodeImplChunk); expect(result).toMatchSnapshot(); }); }); describe("for grouped connection chunks", () => { it("should convert connection group chunk to connections", () => { const structureNodeImplChunk: NodeImplChunk = { "offset": { "line": 10, "column": 2 }, "type": ChunkType.NodeImpl, "children": [ { "offset": { "line": 11, "column": 4 }, "type": ChunkType.ChildNodes, "children": [ { "offset": { "line": 12, "column": 6 }, "type": ChunkType.ChildNodesItem, "captures": [ "(start program):(core).(Start)", { "type": ChunkType.NodeDecl, "captures": [ "(start program):(core).(Start)", { "type": ChunkType.Identifier, "captures": [ "(start program)" ], "offset": { "line": 12, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(Start)" ], "offset": { "line": 12, "column": 6 } } ], "offset": { "line": 12, "column": 6 } } ] }, { "offset": { "line": 13, "column": 6 }, "type": ChunkType.ChildNodesItem, "children": [ { "offset": { "line": 14, "column": 8 }, "type": ChunkType.NodeParam, "captures": [ "param (value) = \"Hello, World!\"", { "type": ChunkType.VarAssignment, "captures": [ "(value) = \"Hello, World!\"", { "type": ChunkType.Identifier, "captures": [ "(value)" ], "offset": { "line": 14, "column": 8 } }, { "type": ChunkType.Any, "captures": [ "\"Hello, World!\"" ], "offset": { "line": 14, "column": 8 } } ], "offset": { "line": 14, "column": 8 } } ] } ], "content": "param (value) = \"Hello, World!\"", "captures": [ "(send \"Hello, World!\"):(core).(Value)", { "type": ChunkType.NodeDecl, "captures": [ "(send \"Hello, World!\"):(core).(Value)", { "type": ChunkType.Identifier, "captures": [ "(send \"Hello, World!\")" ], "offset": { "line": 13, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(Value)" ], "offset": { "line": 13, "column": 6 } } ], "offset": { "line": 13, "column": 6 } } ] }, { "offset": { "line": 15, "column": 6 }, "type": ChunkType.ChildNodesItem, "captures": [ "(log to console):(console).(Console Log)", { "type": ChunkType.NodeDecl, "captures": [ "(log to console):(console).(Console Log)", { "type": ChunkType.Identifier, "captures": [ "(log to console)" ], "offset": { "line": 15, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(Console Log)" ], "offset": { "line": 15, "column": 6 } } ], "offset": { "line": 15, "column": 6 } } ] } ], "content": "(start program):(core).(Start)\n(send \"Hello, World!\"):(core).(Value)\n param (value) = \"Hello, World!\"\n(log to console):(console).(Console Log)", "captures": [ "children" ] }, { "offset": { "line": 16, "column": 4 }, "type": ChunkType.Connections, "children": [ { "offset": { "line": 17, "column": 6 }, "type": ChunkType.ConnectionsItem, "captures": [ "(start program).out.(start) and (send \"Hello, World!\").in.(start)", { "type": ChunkType.ConnectionBody, "captures": [ "(start program).out.(start) and (send \"Hello, World!\").in.(start)", { "type": ChunkType.ChildPort, "captures": [ "(start program).out.(start)", { "type": ChunkType.Identifier, "captures": [ "(start program)" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(start)" ], "offset": { "line": 17, "column": 6 } } ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.ChildPort, "captures": [ "(send \"Hello, World!\").in.(start)", { "type": ChunkType.Identifier, "captures": [ "(send \"Hello, World!\")" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 17, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(start)" ], "offset": { "line": 17, "column": 6 } } ], "offset": { "line": 17, "column": 6 } } ], "offset": { "line": 17, "column": 6 } } ] }, { "offset": { "line": 18, "column": 6 }, "type": ChunkType.ConnectionsItem, "captures": [ "(send \"Hello, World!\").out.(value) and (log to console).in.(value)", { "type": ChunkType.ConnectionBody, "captures": [ "(send \"Hello, World!\").out.(value) and (log to console).in.(value)", { "type": ChunkType.ChildPort, "captures": [ "(send \"Hello, World!\").out.(value)", { "type": ChunkType.Identifier, "captures": [ "(send \"Hello, World!\")" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "out" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(value)" ], "offset": { "line": 18, "column": 6 } } ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.ChildPort, "captures": [ "(log to console).in.(value)", { "type": ChunkType.Identifier, "captures": [ "(log to console)" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.ChildPortDirection, "captures": [ "in" ], "offset": { "line": 18, "column": 6 } }, { "type": ChunkType.Identifier, "captures": [ "(value)" ], "offset": { "line": 18, "column": 6 } } ], "offset": { "line": 18, "column": 6 } } ], "offset": { "line": 18, "column": 6 } } ] } ], "content": "(start program).out.(start) and (send \"Hello, World!\").in.(start)\n(send \"Hello, World!\").out.(value) and (log to console).in.(value)", "captures": [ "connect" ] } ], "content": "children\n (start program):(core).(Start)\n (send \"Hello, World!\"):(core).(Value)\n param (value) = \"Hello, World!\"\n (log to console):(console).(Console Log)\nconnect\n (start program).out.(start) and (send \"Hello, World!\").in.(start)\n (send \"Hello, World!\").out.(value) and (log to console).in.(value)", "captures": [ "in all", { "type": ChunkType.BuiltinTarget, "captures": [ "all" ], "offset": { "line": 10, "column": 2 } }, null ] }; const result = nodeImplChunkToStructureNodeDef(structureNodeImplChunk); expect(result).toMatchSnapshot(); }); }); });