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.
22 lines
1.8 KiB
JavaScript
22 lines
1.8 KiB
JavaScript
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const source = fs.readFileSync(path.resolve(__dirname, '../src/views/foundation/product-development-process.vue'), 'utf8');
|
|
const guidePath = path.resolve(__dirname, '../../dianshang-houduan/src/main/resources/static/file/training-materials/product-development-process/3.甘特图制作实训操作说明.docx');
|
|
const templatePath = path.resolve(__dirname, '../../dianshang-houduan/src/main/resources/static/file/training-materials/product-development-process/3.项目进度管理表-项目进度甘特图模版.xlsx');
|
|
|
|
test('甘特图实训操作说明从后端内置资料目录下载', () => {
|
|
assert.ok(fs.existsSync(guidePath), '操作说明应随后端资源发布');
|
|
assert.ok(source.includes('/file/training-materials/product-development-process/3.甘特图制作实训操作说明.docx'), '下载按钮应指向后端文件服务');
|
|
assert.ok(source.includes('function downloadBuiltInFile'), '下载应使用统一文件下载方法');
|
|
assert.doesNotMatch(source.match(/function downloadPracticeGuide\(\)[\s\S]*?\n}\n\nfunction downloadGanttTemplate/)?.[0] || '', /new Blob/, '操作说明不应再由前端临时生成文本文件');
|
|
});
|
|
|
|
test('甘特图绘制模板从后端内置资料目录下载', () => {
|
|
assert.ok(fs.existsSync(templatePath), '甘特图模板应随后端资源发布');
|
|
assert.ok(source.includes('/file/training-materials/product-development-process/3.项目进度管理表-项目进度甘特图模版.xlsx'), '模板按钮应指向后端文件服务');
|
|
assert.doesNotMatch(source.match(/function downloadGanttTemplate\(\)[\s\S]*?\n}\n\nfunction downloadBuiltInFile/)?.[0] || '', /XLSX\.writeFile/, '模板不应再由前端即时生成');
|
|
});
|