import { beforeEach, describe, expect, it, vi } from "vitest"; const mockSynthesize = vi.fn(); vi.mock("@/lib/graph/investigation-overview-synthesis.js", () => ({ synthesizeInvestigationOverview: (...args) => mockSynthesize(...args), })); vi.mock("@/lib/llm/provider.js", () => ({ getProvider: () => ({ generateReconstruction() {} }), getProviderModelName: () => "gpt-5.6-terra", })); describe("POST /api/cases/overview provider routing", () => { beforeEach(() => mockSynthesize.mockClear()); it("passes the central provider and model resolution to overview synthesis", async () => { mockSynthesize.mockResolvedValue({ understanding: "Understanding", plausibleInterpretations: "None" }); const { POST } = await import("@/app/api/cases/overview/route.js"); const response = await POST(new Request("http://localhost/api/cases/overview", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ situationGraph: { nodes: [], edges: [] }, findings: [], plausibleInterpretations: [] }), })); expect(response.status).toBe(200); expect(mockSynthesize.mock.calls[0][1]).toMatchObject({ modelName: "gpt-5.6-terra" }); }); });