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

const componentSource = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/RiskDetailSection.vue"
  ),
  "utf8"
);
const statementApiSource = fs.readFileSync(
  path.resolve(__dirname, "../../src/api/ccdiProjectBankStatement.js"),
  "utf8"
);

[
  '@change="handleSuspiciousModelSelectChange"',
  "resetSuspiciousFilterResults()",
  "const requestSeq = ++this.suspiciousRequestSeq;",
  "if (requestSeq !== this.suspiciousRequestSeq)",
  "if (requestSeq === this.suspiciousRequestSeq)",
  "this.suspiciousTransactionList = normalizeSuspiciousRows(data.rows);",
  "const projectChanged =",
  "if (projectChanged) {",
  "modelCode: this.selectedModelCode",
  "suspiciousType: this.currentSuspiciousType",
  "const cacheKey = `${bankStatementId}|${suspiciousType || \"ALL\"}|${modelCode || \"ALL\"}`;",
].forEach((token) => assert(componentSource.includes(token), token));

assert(
  !componentSource.includes("async hydrateSuspiciousRows(rows)"),
  "涉疑列表不得再按行请求详情补标签"
);
assert(
  !componentSource.includes("deep: true"),
  "父页面同项目数据更新不得通过深度监听重置筛选"
);

[
  "getBankStatementDetail(bankStatementId, params)",
  "params,",
].forEach((token) => assert(statementApiSource.includes(token), token));
