43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
const assert = require("assert");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const uploadPath = path.resolve(
|
|
__dirname,
|
|
"../../src/views/ccdiProject/components/detail/UploadData.vue"
|
|
);
|
|
const paramPath = path.resolve(
|
|
__dirname,
|
|
"../../src/views/ccdiProject/components/detail/ParamConfig.vue"
|
|
);
|
|
const uploadSource = fs.readFileSync(uploadPath, "utf8");
|
|
const paramSource = fs.readFileSync(paramPath, "utf8");
|
|
|
|
assert(
|
|
uploadSource.includes('return String(this.projectInfo.projectStatus) === "2";'),
|
|
"上传数据页应声明归档态判断"
|
|
);
|
|
|
|
assert(
|
|
/if\s*\(this\.isProjectTagging\s*\|\|\s*this\.isProjectArchived\)/.test(uploadSource),
|
|
"上传数据页的操作入口应同时拦截打标中和已归档"
|
|
);
|
|
|
|
assert(
|
|
paramSource.includes('return String(this.projectInfo.projectStatus) === "2";'),
|
|
"参数配置页应声明归档态判断"
|
|
);
|
|
|
|
assert(
|
|
paramSource.includes("已归档项目暂不可修改参数"),
|
|
"参数配置页应展示归档态只读提示"
|
|
);
|
|
|
|
assert(
|
|
/:disabled="isProjectTagging \|\| isProjectArchived \|\| saving"/.test(paramSource) ||
|
|
/:disabled="isProjectTagging \|\| isProjectArchived"/.test(paramSource),
|
|
"参数保存入口应在归档态下禁用"
|
|
);
|
|
|
|
console.log("project-archive-readonly-guard test passed");
|