You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
1.0 KiB
JavaScript
23 lines
1.0 KiB
JavaScript
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/product/market-opportunity-selection.vue");
|
|
const source = fs.readFileSync(sourcePath, "utf8");
|
|
const guidePath = path.resolve(
|
|
__dirname,
|
|
"../../dianshang-houduan/src/main/resources/static/file/training-materials/market-opportunity-selection/6.综合得分计算操作说明.docx"
|
|
);
|
|
|
|
test("综合得分计算操作说明从后端内置资料目录下载", () => {
|
|
assert.ok(fs.existsSync(guidePath), "操作说明应随后端资源发布");
|
|
assert.match(
|
|
source,
|
|
/\/file\/training-materials\/market-opportunity-selection\/6\.综合得分计算操作说明\.docx/,
|
|
"下载按钮应指向后端文件服务"
|
|
);
|
|
const functionBody = source.match(/function downloadInstructions\(\)[\s\S]*?\n}\nfunction downloadTemplate/)?.[0] || "";
|
|
assert.doesNotMatch(functionBody, /new Blob/, "操作说明不应再由前端临时生成文本文件");
|
|
});
|