import { describe, expect, it } from "vitest";
import { POST } from "@/app/api/mindmap-ai/expand-node/route";

describe("/api/mindmap-ai/expand-node route", () => {
  it("显式退役旧 Next route，并指向 AI Agent 内置工具", async () => {
    const response = await POST();
    const payload = await response.json() as {
      error: string;
      code: string;
      replacement: {
        kind: string;
        toolName: string;
        route: string;
      };
    };

    expect(response.status).toBe(410);
    expect(response.headers.get("x-mnote-compat-boundary")).toBe("mindmap-expand-node-route-retired");
    expect(payload).toMatchObject({
      code: "mindmap-expand-node-route-retired",
      replacement: {
        kind: "ai-agent-tool",
        toolName: "mindmap_expand_node",
        route: "/api/ai-agent/run",
      },
    });
    expect(payload.error).toContain("mindmap_expand_node");
  });
});
