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/step-one-choice-questions.s...

33 lines
1.2 KiB
JavaScript

const assert = require("assert");
const fs = require("fs");
const path = require("path");
const root = path.resolve(__dirname, "..");
const read = (relativePath) => fs.readFileSync(path.join(root, relativePath), "utf8");
const util = read("src/utils/stepOneChoiceQuestions.js");
const editor = read("src/views/components/StepOneChoiceQuestionEditor.vue");
const studentQuestions = read("src/views/components/TrainingStepOneChoiceQuestions.vue");
for (const key of ["new-product-survey", "industry-demand-analysis", "competitive-environment-analysis"]) {
assert.match(util, new RegExp(key));
}
assert.match(editor, /新增题目/);
assert.match(editor, /正确答案/);
assert.match(studentQuestions, /el-radio-group/);
for (const page of [
"src/views/schoolAdmin/trainingTask/index.vue",
"src/views/teacherEnd/trainingTask/index.vue",
]) {
const source = read(page);
assert.match(source, /编辑选择题/);
assert.match(source, /stepOneQuestions/);
}
for (const page of [
"src/views/foundation/new-product-survey.vue",
"src/views/demand/industry-demand-analysis.vue",
"src/views/demand/environment.vue",
]) {
assert.match(read(page), /TrainingStepOneChoiceQuestions/);
}
console.log("step-one choice questions static checks passed");