test(ui): spread the real lucide-react module in the KeyInfoView mock

The mock returned only CopyIcon and CheckIcon, so any icon a child later
imports resolves to undefined. DeleteResourceModal now renders CircleAlert,
which broke all twelve cases in this file.
This commit is contained in:
Yuneng Jiang 2026-08-14 06:22:06 -07:00
parent afff1b08fa
commit d7ec4d98b1
No known key found for this signature in database

View file

@ -182,7 +182,8 @@ vi.mock("@heroicons/react/outline", async () => {
return { ArrowLeftIcon, TrashIcon, RefreshIcon };
});
vi.mock("lucide-react", async () => {
vi.mock("lucide-react", async (importOriginal) => {
const actual = await importOriginal<typeof import("lucide-react")>();
const React = await import("react");
function CopyIcon() {
return React.createElement("span");
@ -192,7 +193,7 @@ vi.mock("lucide-react", async () => {
return React.createElement("span");
}
(CheckIcon as any).displayName = "CheckIcon";
return { CopyIcon, CheckIcon };
return { ...actual, CopyIcon, CheckIcon };
});
// Heavy children -> async factories & local React