const assert = require("assert");
const fs = require("fs");
const path = require("path");

const sidebar = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/ProjectAnalysisSidebar.vue"
  ),
  "utf8"
);
const dialog = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/ProjectAnalysisDialog.vue"
  ),
  "utf8"
);
const entry = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/PreliminaryCheck.vue"
  ),
  "utf8"
);

[
  "sidebar-profile",
  "sidebar-profile__name",
  "sidebar-risk-badge",
  "sidebar-profile__meta",
  "sidebar-summary",
  "sidebar-summary__count",
  "sidebar-tag-list",
  "formatRiskTag",
  "tag.ruleName",
  "flex-wrap: wrap",
  "align-items: flex-start",
  "border: 1px solid #dbe4ef",
  "border-radius: 6px",
].forEach((token) => assert(sidebar.includes(token), token));

assert(!sidebar.includes("当前命中模型"), "命中模型摘要应移除当前命中模型字段");
assert(!sidebar.includes("排查记录摘要"), "侧栏应移除排查记录摘要");
assert(!sidebar.includes("position: sticky"), "左侧整卡不应保持固定");
assert(!sidebar.includes("border-radius: 20px"), "侧栏不应继续保留旧大圆角卡片样式");
assert(!sidebar.includes("background: rgba(255, 255, 255, 0.9)"), "侧栏不应继续保留旧半透明卡片底色");
assert(!sidebar.includes("justify-content: space-between"), "不应继续以表单式左右对齐作为主体布局");

assert(!sidebar.includes("关系人画像"), "侧栏不应扩展到额外区块");
assert(!sidebar.includes("资产分布"), "侧栏不应扩展到额外区块");

[
  "this.detailData && this.detailData.basicInfo",
  "...(this.modelSummary || {})",
  "align-items: flex-start",
].forEach((token) => assert(dialog.includes(token), token));

assert(entry.includes(':model-summary="projectAnalysisModelSummary"'), "入口页应继续透传模型摘要");
