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

const source = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/RiskDetailSection.vue"
  ),
  "utf8"
);

[
  'const mergeRiskModelOptions = (...optionGroups) => {',
  'const isExternalModelCode = (value) => (',
  'if (this.currentSuspiciousType === "ALL") {',
  'return mergeRiskModelOptions(this.riskModelOptions, EXTERNAL_RISK_MODEL_OPTIONS);',
  'if (value === "MODEL_RULE" && isExternalModelCode(this.selectedModelCode)) {',
  'this.selectedModelCode = "";',
].forEach((token) => assert(source.includes(token), token));

[
  '@change="handleModelSelectChange"',
  'handleModelSelectChange(value) {',
  'this.currentSuspiciousType = "EXTERNAL_PERSON";',
  'label="可疑规则"',
  'placeholder="全部可疑规则"',
  '{ value: "ALL", label: "全部可疑规则" }',
].forEach((token) => assert(!source.includes(token), token));
