test(chat): import the route statically so a loaded run cannot time out
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
774eaca13f
commit
1dbe719e2c
1 changed files with 4 additions and 1 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue