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.
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
|
|
const source = fs.readFileSync(path.resolve(__dirname, "../src/views/student/index.vue"), "utf8");
|
|
|
|
test("学生首页并列展示 AI 评分和老师评分", () => {
|
|
assert.match(source, /AI评分/);
|
|
assert.match(source, /老师评分/);
|
|
assert.match(source, /report\.value\.teacherScore/);
|
|
assert.match(source, /formatTeacherScore/);
|
|
});
|
|
|
|
test("学生首页成绩摘要保持单行且不展示当前排名", () => {
|
|
assert.match(source, /\.score-summary[^}]*flex-wrap:\s*nowrap/);
|
|
assert.match(source, /\.score-summary[^}]*white-space:\s*nowrap/);
|
|
assert.doesNotMatch(source, /当前排名/);
|
|
assert.doesNotMatch(source, /rank-copy/);
|
|
});
|
|
|
|
test("老师未评分时不拼接分数单位", () => {
|
|
assert.match(source, /const hasTeacherScore = \(value\) => value !== null && value !== undefined && value !== ""/);
|
|
assert.match(source, /v-if="hasTeacherScore\(teacherScore\)"/);
|
|
});
|
|
|
|
console.log("student home AI and teacher score static checks passed");
|