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

const componentPath = path.resolve(
  __dirname,
  "../../src/views/ccdiIntermediary/components/ImportDialog.vue"
);
const source = fs.readFileSync(componentPath, "utf8");

[
  "scene: {",
  "default: PERSON_SCENE",
  "this.scene === ENTERPRISE_RELATION_SCENE",
  "/ccdi/intermediary/importPersonData",
  "/ccdi/intermediary/importEnterpriseRelationData",
  "ccdi/intermediary/importPersonTemplate",
  "ccdi/intermediary/importEnterpriseRelationTemplate",
  "getPersonImportStatus",
  "getEnterpriseRelationImportStatus",
  "personSubType 为字典下拉；",
  "本人行 relatedNumId 为空；",
  "亲属行 relatedNumId 填关联中介本人证件号码。",
  "只导入中介与机构关系；",
  "统一社会信用代码必须已存在于系统机构表。"
].forEach((token) => {
  assert(source.includes(token), `中介导入弹窗缺少场景驱动能力: ${token}`);
});

[
  'label="导入类型"',
  "个人中介",
  "机构中介",
  "formData.importType",
  "handleImportTypeChange"
].forEach((token) => {
  assert(!source.includes(token), `中介导入弹窗不应继续保留内部类型切换: ${token}`);
});

console.log("intermediary-import-dialog test passed");
