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 abnormalTab = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/ProjectAnalysisAbnormalTab.vue"
  ),
  "utf8"
);
const placeholderTab = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/ProjectAnalysisPlaceholderTab.vue"
  ),
  "utf8"
);

[
  "<project-analysis-abnormal-tab",
  ':detail-data="dialogData.abnormalDetail"',
  'class="project-analysis-tabs"',
].forEach((token) => assert(dialog.includes(token), token));

assert(!dialog.includes("project-analysis-layout__main-scroll"), "主区不应再有独立滚动容器");

[
  "detailData.groups",
  'group.groupType === "BANK_STATEMENT"',
  'group.groupType === "OBJECT"',
  "group.groupName",
  "abnormal-card__content",
  "statementPageSize: 5",
  "statementPageMap",
  "slice(startIndex, startIndex + this.statementPageSize)",
  "<el-pagination",
  ':page-size="statementPageSize"',
  '@current-change="handleStatementPageChange(group, $event)"',
  "交易时间",
  "本方信息",
  "对方信息",
  "摘要/交易类型",
  "异常标签",
  "交易金额",
  "title",
  "subtitle",
  "异常原因快照",
  "reasonDetail",
  "summary",
  "extraFields",
  "grid-template-columns: minmax(0, 1fr)",
  "align-items: flex-start",
].forEach((token) => assert(abnormalTab.includes(token), token));

assert(!abnormalTab.includes("border-radius: 12px"), "异常明细内部不应继续使用独立 12px 圆角");

[
  "placeholder-panel",
  "placeholder-panel__title",
  "placeholder-panel__text",
].forEach((token) => assert(placeholderTab.includes(token), token));
