Fix sports.test.tsx timeout: mock SportIcon to eliminate async image-error state updates #77
1 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,16 @@ vi.mock("~/models/sport", () => ({
|
||||||
findPublicSportsWithCurrentSeasons: vi.fn(),
|
findPublicSportsWithCurrentSeasons: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
vi.mock("~/components/SportIcon", async () => {
|
||||||
|
const { resolveSportIconUrl } = await import("~/lib/sport-icon-url");
|
||||||
|
return {
|
||||||
|
SportIcon: ({ sportName, iconUrl }: { sportName: string; iconUrl?: string | null }) => {
|
||||||
|
const src = resolveSportIconUrl(iconUrl);
|
||||||
|
return src ? <img src={src} alt={sportName} /> : null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
import Sports, { loader } from "../sports";
|
import Sports, { loader } from "../sports";
|
||||||
import { findPublicSportsWithCurrentSeasons } from "~/models/sport";
|
import { findPublicSportsWithCurrentSeasons } from "~/models/sport";
|
||||||
import type { PublicSportWithCurrentSeasons } from "~/models/sport";
|
import type { PublicSportWithCurrentSeasons } from "~/models/sport";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue