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...

41 lines
3.9 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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(page, /const STEP_TWO_PLATFORM_OPTIONS = \[/, "step two must offer the prescribed survey platforms");
assert.match(page, /const STEP_TWO_SCENE_OPTIONS = \[/, "step two must offer the prescribed survey scenes");
assert.match(page, /v-if="step2Form\.scene === '其他场景'"/, "other scenes must reveal a custom-scene input");
assert.match(page, /MAX_STEP_TWO_IMAGES = 5/, "step two must cap product image uploads at five");
assert.match(page, /@click="previewStepTwoImage\(image\.url\)"/, "uploaded product thumbnails must be previewable");
assert.match(page, /step2Answer: JSON\.stringify\(step2Form\.value\)/, "step two must persist the survey form instead of table rows");
assert.match(page, /checkNewProductSurveyStepTwo\(step2Form\.value\)/, "step two must request server-side validation before advancing");
assert.match(api, /new-product-survey\/step-2\/validate/, "the student API must call the step-two validation endpoint");
assert.match(page, /const STEP_THREE_REFERENCE_ROWS = \[/, "step three must define the fixed AI learning-machine reference rows");
assert.match(page, /step2Form\.productName \|\| '所选产品'/, "step three must use the surveyed product name as its analysis-column heading");
assert.match(page, /countStepThreePoints\(row\.analysis\)/, "step three must show the number of entered analysis points");
assert.match(page, /checkNewProductSurveyStepThree\(buildStepThreeValidationPayload\(\)\)/, "step three must validate its rows before advancing");
assert.match(api, /new-product-survey\/step-3\/validate/, "the student API must call the step-three validation endpoint");
assert.match(page, /AI技术是否实现产品功能突破是否形成差异化卖点/, "step four must show the core-layer prototype question");
assert.match(page, /AI技术是否影响产品形态如产品外形包装、电商主图设计、参数配置、价格带定位。/, "step four must show the tangible-layer prototype question");
assert.match(page, /AI技术如何通过服务升级、内容更新提升用户粘性推动付费服务/, "step four must show the extended-layer prototype question");
assert.match(page, /checkNewProductSurveyStepFour\(step4Form\.value\)/, "step four must validate before submission");
assert.match(api, /new-product-survey\/step-4\/validate/, "the student API must call the step-four validation 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");