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/product-development-factors...

24 lines
1.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, /buildAnswerPayload\("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, /buildAnswerPayload\("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");
console.log("product development factors step-one contract passed");