I have decided to put this on hold since the node props will likely be different after the refactoring phase for the react-draw tool.
TypeError: Cannot read property 'current' of undefined
43 | console.log(svg.nodes)
44 | }
> 45 | if (svg.nodes.current[element] !== undefined) {
| ^
46 | return svg.nodes.current[element].isSelected();
47 | } else if (svg.bools.current[element] !== undefined) {
48 | return svg.bools.current[element].isSelected();
at current (js/components/graph/Node.js:45:23)
it("should match shallow snapshot", () => {
const nodeProps = {
"JSON": {
"graph": 1,
"height": 24,
"type_": "Hybrid",
"text": [{
"graph": 1,
"rId": "text103",
"text": "(H101)",
"pos": [596.555968, 59.379107999999995],
"fill": "",
"align": "begin"
}],
"width": 52.768799,
"stroke": "",
"pos": [600.585648, 41.51310800000002],
"fill": "#888888",
"id_": "h108"
},
"className": "hybrid",
"hybrid": true,
"parents": ["aaa101"],
"childs": ["aaa201"],
"inEdges": [],
"outEdges": ["p6"],
"svg": {
"props": {
"start_blank": false,
"edit": false,
"initialDrawMode": "draw-node"
},
"context": {},
"refs": {},
"updater": {},
"state": {
"labelsJSON": [],
"regionsJSON": [],
"nodesJSON": [{
"graph": 1,
"height": 30,
"type_": "Node",
"text": [{
"graph": 1,
"rId": "text102",
"text": "AAA101",
"pos": [596.555968, 25.379107999999995],
"fill": "",
"align": "begin"
}, {
"graph": 1,
"rId": "text103",
"text": "(H101)",
"pos": [596.555968, 34.379107999999995],
"fill": "",
"align": "begin"
}],
"width": 65,
"stroke": "",
"pos": [594.294128, 10.09390799999999],
"fill": "#5dd5b8",
"id_": "aaa101"
}],
"edgesJSON": [],
"highlightedNodes": [],
"timeouts": [],
"fceCount": 0,
"width": 1217.9941,
"height": 646.78271,
"zoomFactor": 1,
"horizontalPanFactor": 0,
"verticalPanFactor": 0,
"mouseDown": false,
"buttonHover": false,
"onDraw": false,
"drawMode": "draw-node",
"drawNodeID": 0,
"draggingNode": null
}
}
};
const wrapper = shallow(<Node {...nodeProps} />);
expect(wrapper).toMatchSnapshot();