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

const entry = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/PreliminaryCheck.vue"
  ),
  "utf8"
);
const people = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/RiskPeopleSection.vue"
  ),
  "utf8"
);
const model = fs.readFileSync(
  path.resolve(
    __dirname,
    "../../src/views/ccdiProject/components/detail/RiskModelSection.vue"
  ),
  "utf8"
);

[
  'import ProjectAnalysisDialog from "./ProjectAnalysisDialog";',
  "ProjectAnalysisDialog",
  "projectAnalysisDialogVisible",
  "<project-analysis-dialog",
  ':visible.sync="projectAnalysisDialogVisible"',
].forEach((token) => assert(entry.includes(token), token));

[
  '@view-project-analysis="handleRiskPeopleProjectAnalysis"',
  '@view-project-analysis="handleRiskModelProjectAnalysis"',
].forEach((token) => assert(entry.includes(token), token));

[
  '@click="handleViewProject(scope.row)"',
  '$emit("view-project-analysis", row)',
  'scope.row.actionLabel || "查看项目"',
].forEach((token) => assert(people.includes(token), token));

[
  '@click="handleViewProject(scope.row)"',
  '$emit("view-project-analysis", row)',
  'scope.row.actionLabel || "查看项目"',
].forEach((token) => assert(model.includes(token), token));
