|
|
|
|
|
const assert = require("node:assert/strict");
|
|
|
|
|
|
const fs = require("node:fs");
|
|
|
|
|
|
const path = require("node:path");
|
|
|
|
|
|
const test = require("node:test");
|
|
|
|
|
|
|
|
|
|
|
|
const sourcePath = path.resolve(__dirname, "../src/views/demand/business-feasibility.vue");
|
|
|
|
|
|
const backendPath = path.resolve(
|
|
|
|
|
|
__dirname,
|
|
|
|
|
|
"../../dianshang-houduan/src/main/java/com/sztzjy/linkCommerce/service/impl/BusinessFeasibilityStepOneServiceImpl.java"
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
test("商业可行性论证第 1 步覆盖七个分析区块并由后端校验计算", () => {
|
|
|
|
|
|
const source = fs.readFileSync(sourcePath, "utf8");
|
|
|
|
|
|
const backend = fs.readFileSync(backendPath, "utf8");
|
|
|
|
|
|
|
|
|
|
|
|
["项目概述", "市场规模与竞争格局", "目标用户群体分析", "商业模式梳理", "成本结构分析", "定价与毛利分析", "风险识别与评估"].forEach((label) => {
|
|
|
|
|
|
assert.match(source, new RegExp(label));
|
|
|
|
|
|
});
|
|
|
|
|
|
assert.match(source, /以下提供了可行性分析的各个子模块/);
|
|
|
|
|
|
assert.match(source, /单位毛利 = 单位目标售价 − 单位总成本/);
|
|
|
|
|
|
assert.match(source, /unitTotalCost/);
|
|
|
|
|
|
assert.match(backend, /validateOverview\(request\.getProjectOverview\(\)\)/);
|
|
|
|
|
|
assert.match(backend, /validateRisks\(request\.getRisks\(\)\)/);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test("目标用户群体表格的表头保持横向表格单元格布局", () => {
|
|
|
|
|
|
const source = fs.readFileSync(sourcePath, "utf8");
|
|
|
|
|
|
|
|
|
|
|
|
assert.match(source, /\.table-wrap th \{[^}]*display:table-cell[^}]*text-align:center/);
|
|
|
|
|
|
});
|