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

const dialog = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/ProjectAnalysisDialog.vue"
  ),
  "utf8"
);
const mockSource = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/preliminaryCheck.mock.js"
  ),
  "utf8"
);

[
  'title="项目分析"',
  "<project-analysis-sidebar",
  "project-analysis-header",
  "project-analysis-workspace",
  'class="project-analysis-tabs"',
  '<el-tabs v-model="activeTab"',
  'name="abnormalDetail"',
  'label="异常明细"',
  'label="资产分析"',
  'label="征信详情"',
  'label="关系图谱"',
  'label="资金流向"',
  "<family-asset-liability-detail",
  "<credit-info-detail",
  "fetchAssetDetailData()",
  "fetchCreditDetailData()",
  "getFamilyAssetLiabilityDetail",
  "getCreditInfoDetail",
  "fetchDetailData()",
  "detailLoading",
  "detailError",
  "handleRetryDetail()",
  "assetLoaded",
  "creditLoaded",
  "缺少项目或人员身份证号，无法加载资产详情",
  "缺少人员身份证号，无法加载征信详情",
].forEach((token) => assert(dialog.includes(token), token));

[
  'width="88%"',
  'top="2vh"',
  "project-analysis-header__main",
  "project-analysis-header__meta",
  "project-analysis-layout__main",
  "flex: 0 0 286px",
  "project-analysis-workspace--sidebar-collapsed",
  "border-radius: 6px",
].forEach((token) => assert(dialog.includes(token), token));

[
  'width="80%"',
  'top="5vh"',
  "project-analysis-shell",
  "project-analysis-layout__main-scroll",
  "overflow-y: auto",
  "max-height: calc(90vh - 120px)",
  "border-radius: 24px",
  "border-radius: 20px",
  "letter-spacing: 0.08em",
].forEach((token) => assert(!dialog.includes(token), token));

[
  "projectAnalysisTabs",
  'key: "abnormalDetail"',
  'key: "assetAnalysis"',
  'key: "creditDetail"',
  'label: "征信详情"',
  'key: "relationshipGraph"',
  'key: "fundFlow"',
].forEach((token) => assert(mockSource.includes(token), token));

[
  'label="征信摘要"',
  'key: "creditSummary"',
  "静态承载征信摘要页签内容，本轮不接入新接口。",
].forEach((token) => assert(!dialog.includes(token) && !mockSource.includes(token), token));
