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/supplier-evaluation-step1.s...

27 lines
1.3 KiB
JavaScript

const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const test = require("node:test");
const source = fs.readFileSync(
path.resolve(__dirname, "../src/views/channel/supplier.vue"),
"utf8",
);
test("供应渠道评估第一步首次进入不预填场景权重", () => {
assert.match(source, /smallBatchWeight:\s*null,\s*largeBatchWeight:\s*null/);
assert.doesNotMatch(source, /smallBatchWeight:\s*20,\s*largeBatchWeight:\s*35/);
});
test("供应渠道评估使用接口 data 中的校验结果和学生答案", () => {
assert.match(source, /const result = \(await validateSupplierEvaluationStepOne\(buildStepOnePayload\(\)\)\)\?\.data \|\| \{\};/);
assert.match(source, /const result = \(await validateSupplierEvaluationStepTwo\(buildStepTwoPayload\(\)\)\)\?\.data \|\| \{\};/);
assert.match(source, /const result = \(await validateSupplierEvaluationStepThree\(buildStepThreePayload\(\)\)\)\?\.data \|\| \{\};/);
assert.match(source, /const answer = \(await getStudentTrainingAnswer\(TASK_KEY\)\)\?\.data \|\| \{\};/);
});
test("供应渠道评估保存时将任务标识和答案作为两个参数传入", () => {
assert.equal((source.match(/saveStudentTrainingAnswer\(TASK_KEY,\s*\{/g) || []).length, 3);
assert.doesNotMatch(source, /saveStudentTrainingAnswer\(\{\s*taskKey:/);
});