import { PortDirection } from "../parser/definition/types/PortDirection"; import { convertStructureNodeDefToLegacyOne } from "./convertStructureNodeDefToLegacyOne"; describe("compileScriptDef()", () => { const node = { inputNames: [ "array", "initial", "part reduced" ], outputNames: [ "reduced", "item", "part reduced" ], spreadInputNames: [], spreadOutputNames: [], childNodesProps: { ["sync array & initial"]: { nodeName: "flow/Syncer", params: { "fields": ["array", "initial"] } }, ["sync index & part reduced"]: { nodeName: "flow/Syncer", params: { "fields": ["index", "part reduced"] } }, ["reduce [synced]"]: { nodeName: "data/array/Reducer [synced]", params: {} } }, connections: [ { from: { direction: PortDirection.output, childName: "sync array & initial", portName: "bundle" }, to: { direction: PortDirection.input, childName: "reduce [synced]", portName: "array & initial" } }, { from: { direction: PortDirection.output, childName: "sync index & part reduced", portName: "bundle" }, to: { direction: PortDirection.input, childName: "reduce [synced]", portName: "index & part reduced" } }, { from: { direction: PortDirection.output, childName: "reduce [synced]", portName: "index" }, to: { direction: PortDirection.input, childName: "sync index & part reduced", portName: "index" } } ], dependencies: [], exposedInputs: { ["array"]: { direction: PortDirection.input, childName: "sync array & initial", portName: "array" }, ["initial"]: { direction: PortDirection.input, childName: "sync array & initial", portName: "initial" }, ["part reduced"]: { direction: PortDirection.input, childName: "sync index & part reduced", portName: "part reduced" } }, exposedOutputs: { ["reduced"]: { direction: PortDirection.output, childName: "reduce [synced]", portName: "reduced" }, ["item"]: { direction: PortDirection.output, childName: "reduce [synced]", portName: "item" }, ["part reduced"]: { direction: PortDirection.output, childName: "reduce [synced]", portName: "part reduced" } } } it("should compile nodes in script", () => { const result = convertStructureNodeDefToLegacyOne("data_array_Reducer", "data/array/Reducer", node) expect(result).toMatchSnapshot(); }); });