Files
storkit/frontend/src/setupTests.ts

15 lines
453 B
TypeScript
Raw Normal View History

import "@testing-library/jest-dom";
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 })),
),
);
});