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

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

[
  "家庭成员年收入",
  "v-model=\"form.annualIncome\"",
  "relationDetail.annualIncome",
  "亲属资产信息",
  "新增资产",
  "handleAddAsset()",
  "handleRemoveAsset(index)",
  "createEmptyAssetRow()",
  "请先填写关系人证件信息",
  "暂无亲属资产信息，请点击新增资产",
  "prop=\"assetInfoList\"",
  "v-model=\"scope.row.assetMainType\"",
  "v-model=\"scope.row.assetSubType\"",
  "v-model=\"scope.row.assetName\"",
  "v-model=\"scope.row.assetStatus\"",
  "v-model=\"scope.row.remarks\"",
].forEach((token) => {
  assert(
    source.includes(token),
    `亲属资产维护弹窗缺少关键结构: ${token}`
  );
});

[
  "v-model=\"scope.row.familyId\"",
  "v-model=\"scope.row.personId\"",
].forEach((token) => {
  assert(
    !source.includes(token),
    `亲属资产维护弹窗不应暴露归属字段: ${token}`
  );
});

console.log("staff-family-asset-maintenance-layout test passed");
