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

const vueSource = fs.readFileSync(
  path.resolve(__dirname, "../../src/views/ccdiProject/components/detail/SpecialCheck.vue"),
  "utf8"
);
const mockSource = fs.readFileSync(
  path.resolve(__dirname, "../../src/views/ccdiProject/components/detail/specialCheck.mock.js"),
  "utf8"
);

["loading", "empty", "loaded"].forEach((state) => {
  assert(vueSource.includes(`pageState === "${state}"`) || vueSource.includes(`pageState === '${state}'`), state);
  assert(mockSource.includes(`${state}:`), `mock 中缺少 ${state} 状态`);
});

assert(vueSource.includes("el-skeleton"), "加载态应保留骨架屏");
assert(vueSource.includes("el-empty"), "空态应保留空态组件");
