schemeta/tests/fixtures/mock-elk-runtime.cjs
2026-02-20 01:31:39 -05:00

22 lines
527 B
JavaScript

class MockElkRuntime {
layoutSync(graph) {
const children = Array.isArray(graph?.children) ? [...graph.children] : [];
const positioned = children.map((node, idx) => {
const col = idx % 4;
const row = Math.floor(idx / 4);
return {
...node,
x: 120 + col * 260,
y: 100 + row * 200
};
});
return {
id: graph?.id ?? "root",
children: positioned,
edges: Array.isArray(graph?.edges) ? graph.edges : []
};
}
}
module.exports = MockElkRuntime;