fix: update all renamed Lucide icons and make icon test dynamic (#150)

- FileEdit -> FilePen (bulk-rename tool)
- Wand2 -> Wand (object eraser)
- Columns -> Columns2 (stitch tool)
- Add Expand to ICON_MAP (ai-canvas-expand)
- Make icon-map test derive icon lists from shared constants instead
  of hardcoding names, preventing future breakage on icon renames
This commit is contained in:
SnapOtter
2026-05-18 17:09:14 +08:00
committed by GitHub
parent 27bbdb6e8a
commit 8b85a8c386
3 changed files with 10 additions and 54 deletions
+4 -2
View File
@@ -11,11 +11,12 @@ import {
Crosshair, Crosshair,
Droplets, Droplets,
Eraser, Eraser,
Expand,
Eye, Eye,
EyeOff, EyeOff,
FileEdit,
FileImage, FileImage,
FileOutput, FileOutput,
FilePen,
FileText, FileText,
FileType, FileType,
Film, Film,
@@ -72,9 +73,10 @@ export const ICON_MAP: Record<string, LucideIcon> = {
Crosshair, Crosshair,
Droplets, Droplets,
Eraser, Eraser,
Expand,
Eye, Eye,
EyeOff, EyeOff,
FileEdit, FilePen,
FileImage, FileImage,
FileOutput, FileOutput,
FileText, FileText,
+1 -1
View File
@@ -84,7 +84,7 @@ export const TOOLS: Tool[] = [
name: "Bulk Rename", name: "Bulk Rename",
description: "Rename multiple files with patterns", description: "Rename multiple files with patterns",
category: "optimization", category: "optimization",
icon: "FileEdit", icon: "FilePen",
route: "/bulk-rename", route: "/bulk-rename",
}, },
{ {
+5 -51
View File
@@ -1,4 +1,5 @@
// @vitest-environment jsdom // @vitest-environment jsdom
import { CATEGORIES, TOOLS } from "@snapotter/shared";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { ICON_MAP } from "@/lib/icon-map"; import { ICON_MAP } from "@/lib/icon-map";
@@ -17,63 +18,16 @@ describe("ICON_MAP", () => {
}); });
it("contains all category icons referenced by shared constants", () => { it("contains all category icons referenced by shared constants", () => {
const categoryIcons = [ const categoryIcons = [...new Set(CATEGORIES.map((c) => c.icon))];
"Layers",
"Zap",
"SlidersHorizontal",
"Stamp",
"Wrench",
"LayoutGrid",
"FileType",
"Sparkles",
];
for (const icon of categoryIcons) { for (const icon of categoryIcons) {
expect(ICON_MAP[icon]).toBeDefined(); expect(ICON_MAP[icon], `ICON_MAP missing category icon "${icon}"`).toBeDefined();
} }
}); });
it("contains all tool icons referenced by shared constants", () => { it("contains all tool icons referenced by shared constants", () => {
const toolIcons = [ const toolIcons = [...new Set(TOOLS.map((t) => t.icon))];
"Maximize2",
"Crop",
"RotateCw",
"FileOutput",
"Minimize2",
"Globe",
"ShieldOff",
"PenLine",
"FileEdit",
"FileText",
"Focus",
"Pipette",
"Eraser",
"ZoomIn",
"Wand2",
"ScanText",
"EyeOff",
"ScanFace",
"Palette",
"Eye",
"Undo2",
"UserCheck",
"Type",
"Image",
"TextCursorInput",
"Info",
"Columns2",
"Copy",
"QrCode",
"ScanLine",
"Code",
"Columns",
"Grid3x3",
"Frame",
"FileImage",
"PenTool",
"Film",
];
for (const icon of toolIcons) { for (const icon of toolIcons) {
expect(ICON_MAP[icon]).toBeDefined(); expect(ICON_MAP[icon], `ICON_MAP missing "${icon}"`).toBeDefined();
} }
}); });