All files / src/utils getNodeConfig.ts

100% Statements 6/6
100% Branches 4/4
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14      1x 95259x 95259x   95259x 24x     95235x    
import { ICanvasNode } from "../components";
import { IGraphConfig } from "../contexts";
 
export const getNodeConfig = (node: ICanvasNode, graphConfig: IGraphConfig) => {
  const shape = node.shape ? node.shape : "rect";
  const nodeConfig = graphConfig.getNodeConfigByName(shape);
 
  if (!nodeConfig) {
    throw new Error(`invalid shape in node ${node.id}`);
  }
 
  return nodeConfig;
};