Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
test(dashboard): applyElkLayout integration cases
Lum110443fd232df71b
diff --git a/understand-anything-plugin/packages/dashboard/src/utils/__tests__/elk-layout.test.ts b/understand-anything-plugin/packages/dashboard/src/utils/__tests__/elk-layout.test.tsindex bd8b7721..f25ad65a 100644--- a/understand-anything-plugin/packages/dashboard/src/utils/__tests__/elk-layout.test.ts+++ b/understand-anything-plugin/packages/dashboard/src/utils/__tests__/elk-layout.test.ts@@ -1,5 +1,5 @@import { describe, it, expect } from "vitest";-import { repairElkInput, type ElkInput } from "../elk-layout";+import { applyElkLayout, repairElkInput, type ElkInput } from "../elk-layout";describe("repairElkInput", () => {it("ensures node dimensions when missing", () => {@@ -70,3 +70,37 @@ describe("repairElkInput", () => {expect(() => repairElkInput(input, { strict: true })).toThrow(/dimensions/);});});++describe("applyElkLayout", () => {+ it("lays out a small graph and returns positions", async () => {+ const result = await applyElkLayout({+ id: "root",+ children: [+ { id: "a", width: 100, height: 50 },+ { id: "b", width: 100, height: 50 },+ ],+ edges: [{ id: "e1", sources: ["a"], targets: ["b"] }],+ layoutOptions: { algorithm: "layered", "elk.direction": "DOWN" },+ });+ expect(result.issues).toEqual([]);+ expect(result.positioned.children).toHaveLength(2);+ for (const c of result.positioned.children) {+ expect(typeof (c as { x?: number }).x).toBe("number");+ expect(typeof (c as { y?: number }).y).toBe("number");+ }+ });++ it("returns fatal issue when ELK rejects (without throwing in non-strict)", async () => {+ // Force ELK rejection by giving an invalid algorithm+ const result = await applyElkLayout(+ {+ id: "root",+ children: [{ id: "a", width: 1, height: 1 }],+ edges: [],+ layoutOptions: { algorithm: "this-algorithm-does-not-exist" },+ },+ { strict: false },+ );+ expect(result.issues.some((i) => i.level === "fatal")).toBe(true);+ });+});