test
This commit is contained in:
29
ruoyi-ui/tests/unit/project-create-upload-jump.test.js
Normal file
29
ruoyi-ui/tests/unit/project-create-upload-jump.test.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const indexPath = path.resolve(__dirname, "../../src/views/ccdiProject/index.vue");
|
||||
const indexSource = fs.readFileSync(indexPath, "utf8");
|
||||
|
||||
assert(
|
||||
indexSource.includes("handleSubmitProject(data)"),
|
||||
"项目创建成功回调应接收创建接口返回的数据"
|
||||
);
|
||||
|
||||
assert(
|
||||
indexSource.includes("path: `/ccdiProject/detail/${data.projectId}`"),
|
||||
"项目创建成功后应跳转到新项目详情页"
|
||||
);
|
||||
|
||||
assert(
|
||||
indexSource.includes('query: { tab: "upload" }') ||
|
||||
indexSource.includes("query: { tab: 'upload' }"),
|
||||
"项目创建成功后应显式激活上传数据页签"
|
||||
);
|
||||
|
||||
assert(
|
||||
!/handleSubmitProject\(data\)\s*\{[\s\S]*?this\.getList\(\)\s*\/\/ 刷新列表[\s\S]*?\}/.test(indexSource),
|
||||
"项目创建成功后不应只刷新列表"
|
||||
);
|
||||
|
||||
console.log("project-create-upload-jump test passed");
|
||||
78
ruoyi-ui/tests/unit/project-tag-failed-status.test.js
Normal file
78
ruoyi-ui/tests/unit/project-tag-failed-status.test.js
Normal file
@@ -0,0 +1,78 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
function readSource(relativePath) {
|
||||
return fs.readFileSync(path.resolve(__dirname, "../../", relativePath), "utf8");
|
||||
}
|
||||
|
||||
const detailSource = readSource("src/views/ccdiProject/detail.vue");
|
||||
const tableSource = readSource("src/views/ccdiProject/components/ProjectTable.vue");
|
||||
const searchBarSource = readSource("src/views/ccdiProject/components/SearchBar.vue");
|
||||
const indexSource = readSource("src/views/ccdiProject/index.vue");
|
||||
const uploadSource = readSource("src/views/ccdiProject/components/detail/UploadData.vue");
|
||||
const paramSource = readSource("src/views/ccdiProject/components/detail/ParamConfig.vue");
|
||||
|
||||
assert(
|
||||
detailSource.includes("latestTagTaskErrorMessage") &&
|
||||
detailSource.includes("latestTagTaskEndTime"),
|
||||
"项目详情接口字段应承载最近失败任务的错误信息和结束时间"
|
||||
);
|
||||
|
||||
assert(
|
||||
detailSource.includes("tagFailureDialogVisible") &&
|
||||
detailSource.includes("项目打标失败") &&
|
||||
detailSource.includes("查看完整错误"),
|
||||
"项目详情页应展示打标失败提示并提供完整错误弹窗"
|
||||
);
|
||||
|
||||
assert(
|
||||
/isProjectTagFailed\(\)\s*\{\s*return String\(this\.projectInfo\.projectStatus\) === "4";\s*\}/.test(
|
||||
detailSource
|
||||
),
|
||||
"项目详情页应显式识别 4-打标失败状态"
|
||||
);
|
||||
|
||||
assert(
|
||||
/4:\s*"danger"/.test(detailSource) && /4:\s*"打标失败"/.test(detailSource),
|
||||
"项目详情页状态映射应支持 4-打标失败"
|
||||
);
|
||||
|
||||
assert(
|
||||
/String\(this\.projectInfo\.projectStatus\)\s*!==\s*"3"/.test(detailSource),
|
||||
"项目状态轮询应在状态变为打标失败后停止"
|
||||
);
|
||||
|
||||
assert(
|
||||
tableSource.includes("['0', '3', '4'].includes(scope.row.status)"),
|
||||
"项目列表中打标失败项目应只开放进入项目入口"
|
||||
);
|
||||
|
||||
assert(
|
||||
!tableSource.includes("latestTagTaskErrorMessage"),
|
||||
"项目列表不应展示完整打标失败错误"
|
||||
);
|
||||
|
||||
assert(
|
||||
searchBarSource.includes("{ label: '打标失败', value: '4', count: 0 }"),
|
||||
"项目筛选栏应提供打标失败筛选项"
|
||||
);
|
||||
|
||||
assert(
|
||||
indexSource.includes("'4': counts.status4 || 0"),
|
||||
"项目首页应接收 status4 统计"
|
||||
);
|
||||
|
||||
assert(
|
||||
uploadSource.includes('return ["0", "3", "4"].includes(String(this.projectInfo.projectStatus));'),
|
||||
"上传数据页应将打标失败按进行中口径禁用报告入口"
|
||||
);
|
||||
|
||||
assert(
|
||||
!uploadSource.includes("isProjectTagFailed") &&
|
||||
!paramSource.includes("isProjectTagFailed") &&
|
||||
!paramSource.includes('projectStatus) === "4"'),
|
||||
"上传和参数配置页不应把打标失败作为只读锁定状态"
|
||||
);
|
||||
|
||||
console.log("project-tag-failed-status test passed");
|
||||
@@ -0,0 +1,51 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const componentPath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiPurchaseTransaction/index.vue"
|
||||
);
|
||||
const source = fs.readFileSync(componentPath, "utf8");
|
||||
|
||||
[
|
||||
'from "@/api/ccdiEnterpriseBaseInfo"',
|
||||
'from "@/api/ccdiEnum"',
|
||||
"enterpriseDetailOpen",
|
||||
"enterpriseDetailLoading",
|
||||
"enterpriseDetailData",
|
||||
"handleSupplierEnterpriseDetail(row)",
|
||||
"resetEnterpriseDetail()",
|
||||
"暂无企业信息"
|
||||
].forEach((token) => {
|
||||
assert(source.includes(token), `招投标供应商企业详情缺少关键结构: ${token}`);
|
||||
});
|
||||
|
||||
[
|
||||
'label="操作"',
|
||||
">详情</el-button>",
|
||||
"企业信息详情",
|
||||
"统一社会信用代码",
|
||||
"企业名称",
|
||||
"企业类型",
|
||||
"企业性质",
|
||||
"行业分类",
|
||||
"所属行业",
|
||||
"法定代表人",
|
||||
"风险等级",
|
||||
"企业来源",
|
||||
"数据来源",
|
||||
"股东5"
|
||||
].forEach((token) => {
|
||||
assert(source.includes(token), `招投标供应商企业详情模板缺少关键结构: ${token}`);
|
||||
});
|
||||
|
||||
[
|
||||
"v-hasPermi=\\\"['ccdi:enterpriseBaseInfo:query']\\\"",
|
||||
"v-hasPermi=\"['ccdi:enterpriseBaseInfo:query']\"",
|
||||
"ccdi:enterpriseBaseInfo:query"
|
||||
].forEach((token) => {
|
||||
assert(!source.includes(token), `本次不应新增实体库权限显隐控制: ${token}`);
|
||||
});
|
||||
|
||||
console.log("purchase-transaction-enterprise-detail-ui test passed");
|
||||
Reference in New Issue
Block a user