From 1dbe719e2c01a5c69b29ebf387aa1e8ac3fd941e Mon Sep 17 00:00:00 2001 From: DEls Date: Sat, 26 Sep 2026 09:55:18 +0200 Subject: [PATCH] test(chat): import the route statically so a loaded run cannot time out Co-Authored-By: Claude Opus 5.5 --- src/app/api/chat/route.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/api/chat/route.test.ts b/src/app/api/chat/route.test.ts index 061db1e..5d523c4 100644 --- a/src/app/api/chat/route.test.ts +++ b/src/app/api/chat/route.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it, vi } from "vitest"; import type { ChatProvider, RunTurnArgs } from "@/lib/chat"; import type { ChartSpec } from "@/lib/reports/chart-spec"; +// Static import (vi.mock is hoisted above it): loading the route pulls in +// the provider SDKs, which is slow under a parallel run and must count +// as collection, not test time. +import { POST } from "./route"; const spec: ChartSpec = { id: "site-weekly", @@ -44,7 +48,6 @@ vi.mock("@/lib/chat", async (importOriginal) => { describe("POST /api/chat", () => { it("streams chart specs to the browser and only ids/titles to the model", async () => { - const { POST } = await import("./route"); const res = await POST( new Request("http://test/api/chat", { method: "POST",