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/hardware-cost.vue"); const templatePath = path.resolve( __dirname, "../../dianshang-houduan/src/main/resources/static/file/training-materials/hardware-cost/16.成本占比结构图绘制模版.xlsx" ); test("硬件成本占比结构图模板由后端内置 Excel 文件提供下载", () => { const source = fs.readFileSync(sourcePath, "utf8"); assert.ok(fs.existsSync(templatePath), "后端应提供成本占比结构图 Excel 模板"); assert.match(source, /\/file\/training-materials\/hardware-cost\/16\.成本占比结构图绘制模版\.xlsx/); assert.match( source, /function downloadCostStructureTemplate\(\) \{\s*downloadBuiltInFile\(HARDWARE_COST_TEMPLATE_URL, "16\.成本占比结构图绘制模版\.xlsx"\);\s*\}/ ); });