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.
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
|
1 month ago
|
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, /提交失败,请稍后重试/);
|
||
|
|
});
|