实现项目归档功能
This commit is contained in:
42
ruoyi-ui/tests/unit/project-archive-readonly-guard.test.js
Normal file
42
ruoyi-ui/tests/unit/project-archive-readonly-guard.test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
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");
|
||||
Reference in New Issue
Block a user