import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";

const appSource = readFileSync(
  new URL("../../../app/App.tsx", import.meta.url),
  "utf8",
);

describe("F5 App scope", () => {
  it("文档浏览和后台管理运行时使用真实 F4 页面，审计模拟数据保持不变", () => {
    for (const marker of ["<RealMainPage", "<RealAdminPage", "const AUDIT_LOGS"]) {
      expect(appSource).toContain(marker);
    }
  });

  it("保留文档列表并接入文件操作", () => {
    expect(appSource).toContain(">查看</button>");
    expect(appSource).not.toContain("请使用列表中的“预览”或“下载”入口读取真实文件");
    expect(appSource).not.toContain("F5 文件管理基线");
    expect(appSource).toContain("共 {state.data?.total ?? 0} 项");
    expect(appSource).not.toContain("列表不请求文件大小");
  });
});
