import {NodeParamsChunk} from "../chunks/types/NodeParamsChunk"; import {ChunkType} from "../chunks/types/ChunkType"; import {nodeParamsChunkToParams} from "./nodeParamsChunkToParams"; describe("nodeParamsChunkToParams()", () => { it("should convert node params chunk to params dictionary", () => { const nodeParamsChunk: NodeParamsChunk = { "offset": { "line": 30, "column": 6 }, "type": ChunkType.NodeParams, "children": [ { "offset": { "line": 31, "column": 8 }, "type": ChunkType.NodeParamsItem, "captures": [ "(fields) = [\"a\", \"b\"]", { "type": ChunkType.VarAssignment, "captures": [ "(fields) = [\"a\", \"b\"]", { "type": ChunkType.Identifier, "captures": [ "(fields)" ], "offset": { "line": 31, "column": 8 } }, { "type": ChunkType.Any, "captures": [ "[\"a\", \"b\"]" ], "offset": { "line": 31, "column": 8 } } ], "offset": { "line": 31, "column": 8 } } ] } ], "content": "(fields) = [\"a\", \"b\"]", "captures": [ "params" ] }; const result = nodeParamsChunkToParams(nodeParamsChunk); expect(result).toMatchSnapshot(); }); });