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.
58 lines
2.0 KiB
JavaScript
58 lines
2.0 KiB
JavaScript
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
|
|
const frontendRoot = path.resolve(__dirname, "..");
|
|
const toolbarPath = path.join(frontendRoot, "src/views/components/TrainingTaskToolbar.vue");
|
|
|
|
const studentTrainingPages = [
|
|
"foundation/new-product-survey.vue",
|
|
"foundation/product-development-factors.vue",
|
|
"foundation/product-development-process.vue",
|
|
"demand/industry-demand-analysis.vue",
|
|
"demand/competitive-environment-analysis.vue",
|
|
"demand/business-feasibility.vue",
|
|
"demand/people.vue",
|
|
"demand/consumer-behavior.vue",
|
|
"demand/consumer-scenario.vue",
|
|
"demand/feature-conversion.vue",
|
|
"product/market-opportunity-selection.vue",
|
|
"product/differentiation.vue",
|
|
"product/structure.vue",
|
|
"product/after-sales-service.vue",
|
|
"product/requirements-doc.vue",
|
|
"product/hardware-cost.vue",
|
|
"product/price.vue",
|
|
"test/index.vue",
|
|
"test/promotion.vue",
|
|
"channel/index.vue",
|
|
"channel/supplier.vue",
|
|
"assessment/index.vue",
|
|
"assessment/diagnosis.vue",
|
|
"assessment/optimization.vue",
|
|
];
|
|
|
|
test("统一实训工具栏同时提供案例下载、提交、重新实训和导出入口", () => {
|
|
const source = fs.readFileSync(toolbarPath, "utf8");
|
|
|
|
assert.match(source, /TrainingMaterialButton/);
|
|
assert.match(source, /提交任务/);
|
|
assert.match(source, /重新实训/);
|
|
assert.match(source, /导出实训成果/);
|
|
});
|
|
|
|
test("每个学生端实训菜单均通过任务说明区接入统一顶部工具栏", () => {
|
|
for (const relativePath of studentTrainingPages) {
|
|
const source = fs.readFileSync(path.join(frontendRoot, "src/views", relativePath), "utf8");
|
|
if (relativePath === "assessment/index.vue") {
|
|
assert.match(source, /<TrainingTaskToolbar\b/, relativePath);
|
|
} else {
|
|
assert.match(source, /<TrainingTaskBrief\b/, relativePath);
|
|
}
|
|
}
|
|
|
|
const briefSource = fs.readFileSync(path.join(frontendRoot, "src/views/components/TrainingTaskBrief.vue"), "utf8");
|
|
assert.match(briefSource, /<TrainingTaskToolbar\b/);
|
|
});
|