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.
52 lines
4.8 KiB
JavaScript
52 lines
4.8 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/product-development-factors.vue"), "utf8");
|
|
const api = fs.readFileSync(path.join(root, "src/api/studentTrainingAnswer.js"), "utf8");
|
|
|
|
assert.match(page, /const STEP_ONE_FACTOR_ROWS = \[/, "step one must define its fixed three rows");
|
|
assert.match(page, /用户需求真实性/, "step one must include user-demand authenticity");
|
|
assert.match(page, /产品体验闭环/, "step one must include product-experience loop");
|
|
assert.match(page, /生态与兼容/, "step one must include ecosystem compatibility");
|
|
assert.match(page, /v-if="currentStep === 0"/, "the factor table must only render on step one");
|
|
assert.match(page, /saveAndGoToStepTwo/, "step one must expose a save-and-advance action");
|
|
assert.match(page, /await checkProductDevelopmentFactorsStepOne\(buildStepOneValidationPayload\(\)\)/, "advance must validate before saving");
|
|
assert.match(page, /buildStepOneAnswerPayload\("SAVE", 2\)/, "advance must save step two progress without submitting");
|
|
assert.doesNotMatch(page, /v-model="form\.successProduct"/, "the prototype must not display a success-product name input");
|
|
assert.doesNotMatch(page, /v-model="form\.failedProduct"/, "the prototype must not display a failed-product name input");
|
|
assert.doesNotMatch(page, /buildStepOneAnswerPayload\("SUBMIT"\)/, "step one must not submit the entire task");
|
|
assert.match(api, /export function checkProductDevelopmentFactorsStepOne\(/, "the student API must expose the step-one validator");
|
|
assert.match(api, /product-development-factors\/step-1\/validate/, "the student API must call the step-one validation route");
|
|
assert.match(page, /const STEP_TWO_FACTOR_ROWS = \[/, "step two must define its fixed rows");
|
|
assert.match(page, /技术应用/, "step two must include technology application");
|
|
assert.match(page, /合规与认证/, "step two must include compliance and certification");
|
|
assert.match(page, /v-else-if="currentStep === 1"/, "the second table must render only on step two");
|
|
assert.match(page, /await checkProductDevelopmentFactorsStepTwo\(buildStepTwoValidationPayload\(\)\)/, "step two must validate before saving");
|
|
assert.match(page, /step2Answer: JSON\.stringify\(buildStepTwoOutcome\(\)\)/, "step two must save its own answer field");
|
|
assert.match(page, /buildStepTwoAnswerPayload\("SAVE", 3\)/, "step two must save progress for step three");
|
|
assert.doesNotMatch(page, /buildStepTwoAnswerPayload\("SUBMIT"/, "step two must not submit the task");
|
|
assert.match(api, /export function checkProductDevelopmentFactorsStepTwo\(/, "the student API must expose the step-two validator");
|
|
assert.match(api, /product-development-factors\/step-2\/validate/, "the student API must call the step-two validation route");
|
|
assert.match(page, /const STEP_THREE_FACTOR_ROWS = \[/, "step three must define its fixed rows");
|
|
assert.match(page, /供应链与成本控制/, "step three must include supply-chain and cost control");
|
|
assert.match(page, /商业模式/, "step three must include business model");
|
|
assert.match(page, /市场反馈/, "step three must include market feedback");
|
|
assert.match(page, /v-else-if="currentStep === 2"/, "the third table must render only on step three");
|
|
assert.match(page, /await checkProductDevelopmentFactorsStepThree\(buildStepThreeValidationPayload\(\)\)/, "step three must validate before saving");
|
|
assert.match(page, /step3Answer: JSON\.stringify\(buildStepThreeOutcome\(\)\)/, "step three must save its own answer field");
|
|
assert.match(page, /buildStepThreeAnswerPayload\("SAVE", 4\)/, "step three must save progress for step four");
|
|
assert.doesNotMatch(page, /buildStepThreeAnswerPayload\("SUBMIT"/, "step three must not submit the task");
|
|
assert.match(api, /export function checkProductDevelopmentFactorsStepThree\(/, "the student API must expose the step-three validator");
|
|
assert.match(api, /product-development-factors\/step-3\/validate/, "the student API must call the step-three validation route");
|
|
assert.match(page, /v-else-if="currentStep === 3"/, "the fourth form must render only on step four");
|
|
assert.match(page, /产品成功的关键因素/, "step four must include success factors");
|
|
assert.match(page, /产品失败的关键因素/, "step four must include failure factors");
|
|
assert.match(page, /step4Answer/, "step four must save its own answer field");
|
|
assert.match(page, /await checkProductDevelopmentFactorsStepFour\(buildStepFourValidationPayload\(\)\)/, "step four must validate before submit");
|
|
assert.match(page, /buildStepFourAnswerPayload\("SUBMIT", 4\)/, "step four must submit the task");
|
|
assert.match(api, /product-development-factors\/step-4\/validate/, "the student API must call the step-four validation route");
|
|
|
|
console.log("product development factors step-one contract passed");
|