feat(ai-character): Mock Preview 모드 구현

This commit is contained in:
Yu Sung
2026-07-27 23:23:36 +09:00
parent b4841ff579
commit 2a5efb0f3e
38 changed files with 4763 additions and 289 deletions

View File

@@ -0,0 +1,29 @@
import { describe, expect, test, vi } from "vitest";
const { setupWorkerMock, workerStart } = vi.hoisted(() => {
const workerStart = vi.fn();
const setupWorkerMock = vi.fn(() => ({ start: workerStart }));
return { setupWorkerMock, workerStart };
});
vi.mock("msw/browser", () => ({
setupWorker: setupWorkerMock,
}));
import { startMockWorker } from "./browser";
describe("startMockWorker", () => {
test("starts browser MSW with an error policy for unhandled requests", async () => {
// Given
vi.stubEnv("VITE_API_BASE_URL", "https://api.example.com");
const startOptions = { onUnhandledRequest: "error" };
// When
await startMockWorker();
// Then
expect(setupWorkerMock).toHaveBeenCalledWith(expect.anything(), expect.anything(), expect.anything());
expect(workerStart).toHaveBeenCalledWith(startOptions);
});
});