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.
26 lines
1.4 KiB
JavaScript
26 lines
1.4 KiB
JavaScript
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
|
|
const page = fs.readFileSync(path.join(__dirname, "../src/views/product/requirements-doc.vue"), "utf8");
|
|
|
|
test("产品需求说明书在已完成匹配且文档就绪时可以提交任务", () => {
|
|
assert.match(page, /const canSubmitTask = computed\(\(\) => stepOnePassed\.value && isDocumentReady\.value\);/);
|
|
assert.match(page, /@click="submitTask"/);
|
|
assert.match(page, /提交任务/);
|
|
assert.match(page, /:disabled="!canSubmitTask \|\| saving \|\| submitting \|\| documentUploading"/);
|
|
});
|
|
|
|
test("产品需求说明书最终提交保存完整答案并标记为已提交", () => {
|
|
assert.match(page, /function buildSubmitPayload\(\) \{ return \{ \.\.\.buildSavePayload\(3\), submitted: true, saveAction: "SUBMIT" \}; \}/);
|
|
assert.match(page, /async function submitTask\(\)[\s\S]*?await saveStudentTrainingAnswer\(TASK_KEY, buildSubmitPayload\(\)\)/);
|
|
assert.match(page, /产品需求文档已提交/);
|
|
assert.match(page, /提交失败,请稍后重试/);
|
|
});
|
|
|
|
test("产品需求说明书第3步将顶部导出操作明确为文档预览", () => {
|
|
assert.match(page, /\{\{ currentStep === 3 \? '预览产品需求说明书' : '导出实训成果' \}\}/);
|
|
assert.match(page, /function exportOutcome\(\)[\s\S]*?currentStep\.value === 3 && isDocumentReady\.value\) \{ showDocumentPreview\.value = true;/);
|
|
});
|