import { describe, expect, it } from "vitest";
import { GET } from "@/app/api/documents/page/route";

describe("documents/page route", () => {
  it("compat 读链应明确返回 410，并指向 page aggregate 正式路由", async () => {
    const response = await GET(
      new Request("http://localhost/api/documents/page?documentId=doc_1&workspaceId=ws_1"),
    );
    const payload = await response.json() as {
      error: string;
      redirectTo: string;
    };

    expect(response.status).toBe(410);
    expect(payload.error).toContain("/api/page-aggregate/:documentId");
    expect(payload.redirectTo).toBe("/api/page-aggregate/doc_1?workspaceId=ws_1");
  });
});
