2026-02-19 12:54:04 +00:00
|
|
|
import "@testing-library/jest-dom";
|
2026-03-19 16:07:56 +00:00
|
|
|
import { beforeEach, vi } from "vitest";
|
|
|
|
|
|
|
|
|
|
// Provide a default fetch mock so components that call API endpoints on mount
|
|
|
|
|
// don't throw URL-parse errors in the jsdom test environment. Tests that need
|
|
|
|
|
// specific responses should mock the relevant `api.*` method as usual.
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
vi.stubGlobal(
|
|
|
|
|
"fetch",
|
|
|
|
|
vi.fn(() =>
|
|
|
|
|
Promise.resolve(new Response(JSON.stringify({}), { status: 200 })),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|