Merge pull request 'fix(canvas): case-insensitive extension lookup in getIcon + topology test fix' (#749) from fix/697-canvas-geticon-topology into staging
All checks were successful
Secret scan / Scan diff for credential-shaped strings (push) Successful in 4s

This commit is contained in:
Molecule AI · app-fe 2026-05-12 18:02:50 +00:00
commit ee4952bbbb
2 changed files with 4 additions and 3 deletions

View File

@ -28,7 +28,7 @@ const FILE_ICONS: Record<string, string> = {
export function getIcon(path: string, isDir: boolean): string {
if (isDir) return "📁";
const ext = "." + path.split(".").pop();
const ext = "." + (path.split(".").pop() ?? "").toLowerCase();
return FILE_ICONS[ext] || "📄";
}

View File

@ -94,9 +94,10 @@ describe("sortParentsBeforeChildren", () => {
{ id: "orphan", parentId: "ghost" },
{ id: "root", parentId: undefined },
];
// Missing parent is skipped; orphan placed after root
// Missing parent is skipped; orphan keeps its input order
// (ghost doesn't exist → orphan is treated as a root in output order)
const result = sortParentsBeforeChildren(nodes);
expect(result.map((n) => n.id)).toEqual(["root", "orphan"]);
expect(result.map((n) => n.id)).toEqual(["orphan", "root"]);
});
});