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/task-assignment-owned-class...

21 lines
958 B
JavaScript

const assert = require("assert");
const fs = require("fs");
const path = require("path");
const root = path.resolve(__dirname, "..");
const taskPage = fs.readFileSync(path.join(root, "src/views/teacherEnd/task/index.vue"), "utf8");
assert(taskPage.includes("function sameValue(left, right)"), "task assignment must normalize class owner identifiers before comparing them");
assert.match(
taskPage,
/const teachingClassList = computed\(\(\) => classList\.value\.filter\(\(item\) =>[\s\S]*sameValue\(item\.createdBy, currentUserId\.value\)/,
"task assignment class options must be limited to classes created by the current teacher"
);
assert.match(
taskPage,
/const canOperateSelectedClass = computed\(\(\) => sameValue\(selectedClass\.value\?\.createdBy, currentUserId\.value\)\)/,
"task assignment operations must use the same current-teacher ownership check"
);
console.log("task assignment class options are scoped to the current teacher");