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.
dianshang-qianduan/tests/training-material.static.te...

35 lines
1.6 KiB
JavaScript

const assert = require("assert");
const fs = require("fs");
const path = require("path");
const root = path.resolve(__dirname, "..");
const teacherPage = fs.readFileSync(path.join(root, "src/views/teacherEnd/trainingTask/index.vue"), "utf8");
const studentPage = fs.readFileSync(path.join(root, "src/views/training/GenericTrainingPage.vue"), "utf8");
const newProductSurveyPage = fs.readFileSync(path.join(root, "src/views/foundation/new-product-survey.vue"), "utf8");
const productDevelopmentFactorsPage = fs.readFileSync(path.join(root, "src/views/foundation/product-development-factors.vue"), "utf8");
assert(
/uploadTrainingTaskMaterial/.test(teacherPage),
"teacher training task editor should use the common upload API for case materials"
);
assert(
/async function handleMaterialChange/.test(teacherPage) && /taskForm\.materialUrl\s*=\s*res\?\.(url|fileName)/.test(teacherPage),
"teacher case material upload should persist the returned materialUrl"
);
assert(
/class="material-download"/.test(studentPage) && /@click="handleMaterialDownload"/.test(studentPage),
"student task page should always render the current route task material button"
);
assert(
/function handleMaterialDownload/.test(studentPage) && /暂无案例文档/.test(studentPage),
"student task material button should report empty state when no case material exists"
);
assert(
/TrainingMaterialButton/.test(newProductSurveyPage),
"new product survey page should render the case material button"
);
assert(
/TrainingMaterialButton/.test(productDevelopmentFactorsPage),
"product development factors page should render the case material button"
);