/**
 * Vitest global setup for MSW.
 * Starts the MSW server before all tests, resets handlers
 * and request log after each test, closes after all tests.
 */
import { beforeAll, afterEach, afterAll } from "vitest";
import { server } from "@/mocks/node.js";
import { clearRequests } from "@/mocks/request-log.js";

beforeAll(() => server.listen({ onUnhandledRequest: "warn" }));
afterEach(() => {
  server.resetHandlers();
  clearRequests();
});
afterAll(() => server.close());
