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");

[
  "导入资产信息",
  "查看员工资产导入失败记录",
  "assetUpload",
  "assetPollingTimer",
  "assetCurrentTaskId",
  "assetFailureDialogVisible",
  "employee_asset_import_last_task",
  "员工资产数据导入",
  "下载员工资产模板",
  "@/api/ccdiBaseStaffAsset",
  "/ccdi/baseStaff/asset/importData",
  "ccdi/baseStaff/asset/importTemplate",
  "getBaseStaffAssetImportStatus",
  "getBaseStaffAssetImportFailures",
  "仅支持导入员工本人资产数据",
].forEach((token) => {
  assert(
    source.includes(token),
    `员工资产导入 UI 缺少关键结构或状态: ${token}`
  );
});

[
  'from "@/api/ccdiAssetInfo"',
  "/ccdi/assetInfo/importData",
  "ccdi/assetInfo/importTemplate",
  "getAssetImportStatus(taskId)",
  "getAssetImportFailures(",
].forEach((token) => {
  assert(
    !source.includes(token),
    `员工资产导入 UI 不应再引用亲属资产接口: ${token}`
  );
});

console.log("employee-asset-import-ui test passed");
