|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
console.log("product development factors step-one contract passed");
|