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

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

[
  "annualIncome: null",
  "label=\"年收入\"",
  "v-model=\"form.annualIncome\"",
  "this.form.annualIncome = response.data.annualIncome",
  "payload.annualIncome = this.normalizeAnnualIncome(payload.annualIncome);",
  "normalizeAnnualIncome(value)",
  "validateAnnualIncome(value, fieldLabel = \"年收入\")",
  "assetInfoList: []",
  "normalizeAssetInfoList()",
  "this.form.assetInfoList = [];",
  "response.data.assetInfoList || []",
  "this.form.assetInfoList = this.normalizeAssetInfoList();",
  "'form.idCard'(newIdCard, oldIdCard)",
  "syncAssetPersonIds(newIdCard, oldIdCard)",
  "this.form.assetInfoList.push(this.createEmptyAssetRow(this.form.idCard));",
  "personId: defaultPersonId || \"\"",
  "assetStatusOptions.some(option => option.value === asset.assetStatus)",
].forEach((token) => {
  assert(
    source.includes(token),
    `员工资产提交流程缺少关键处理: ${token}`
  );
});

console.log("employee-asset-submit-flow test passed");
