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/new-product-survey-step-one...

23 lines
1.6 KiB
JavaScript

const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const root = path.resolve(__dirname, "..");
const page = fs.readFileSync(path.join(root, "src/views/foundation/new-product-survey.vue"), "utf8");
const api = fs.readFileSync(path.join(root, "src/api/studentTrainingAnswer.js"), "utf8");
const materialButton = fs.readFileSync(path.join(root, "src/views/components/TrainingMaterialButton.vue"), "utf8");
assert.match(page, /const STEP_ONE_SELLING_POINTS = \[/, "step one must define its fixed selling-point questions");
assert.ok((page.match(/selling-point-/g) || []).length >= 11, "step one must contain all 11 selling points");
assert.match(page, /核心层/, "classification options must include 核心层");
assert.match(page, /有形层/, "classification options must include 有形层");
assert.match(page, /延伸层/, "classification options must include 延伸层");
assert.match(page, /checkNewProductSurveyStepOne/, "step one must request server-side grading");
assert.match(page, /checkResult/, "step one must retain grading feedback");
assert.match(page, /TrainingMaterialButton/, "the existing material download button must remain in place");
assert.match(api, /new-product-survey\/step-1\/check/, "the student API must call the step-one grading endpoint");
assert.match(materialButton, /下载案例资料/, "the download button must use a fixed student-facing label");
assert.doesNotMatch(materialButton, /\{\{ material\?\.name \|\| "案例文档" \}\}/, "the upload file name must not become button text");
console.log("new product survey step-one contract passed");