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.
41 lines
2.6 KiB
JavaScript
41 lines
2.6 KiB
JavaScript
|
1 month ago
|
const assert = require("assert");
|
||
|
|
const fs = require("fs");
|
||
|
|
const path = require("path");
|
||
|
|
|
||
|
|
const frontendRoot = path.resolve(__dirname, "..");
|
||
|
|
const backendRoot = path.resolve(frontendRoot, "..", "link_commerce");
|
||
|
|
const readFrontend = (file) => fs.readFileSync(path.join(frontendRoot, file), "utf8");
|
||
|
|
const readBackend = (file) => fs.readFileSync(path.join(backendRoot, file), "utf8");
|
||
|
|
|
||
|
|
const taskPage = readFrontend("src/views/teacherEnd/task/index.vue");
|
||
|
|
const trainingTaskPage = readFrontend("src/views/teacherEnd/trainingTask/index.vue");
|
||
|
|
const scorePage = readFrontend("src/views/teacherEnd/score/index.vue");
|
||
|
|
const reviewPage = readFrontend("src/views/teacherEnd/score/TaskReviewPanel.vue");
|
||
|
|
const teacherHome = readFrontend("src/views/teacherEnd/index.vue");
|
||
|
|
const examService = readBackend("src/main/java/com/sztzjy/linkCommerce/service/ExamService.java");
|
||
|
|
|
||
|
|
assert.match(taskPage, /const isManagerTeacher = computed\(\(\) => userStore\.userInfo\.teacherAdmin === true\)/);
|
||
|
|
assert.match(taskPage, /isManagerTeacher\.value \|\| sameValue\(item\.createdBy, currentUserId\.value\)/);
|
||
|
|
|
||
|
|
assert.match(trainingTaskPage, /const isManagerTeacher = computed\(\(\) => userStore\.userInfo\.teacherAdmin === true\)/);
|
||
|
|
assert.match(trainingTaskPage, /isManagerTeacher\.value \|\| String\(schoolClass\.createdBy \|\| ""\) === String\(currentUserId\.value \|\| ""\)/);
|
||
|
|
assert.match(trainingTaskPage, /const isReadonly = computed\(\(\) => dialogMode\.value === "view" \|\| !canOperateSelectedClass\.value\)/);
|
||
|
|
|
||
|
|
assert.match(scorePage, /const isManagerTeacher = computed\(\(\) => userStore\.userInfo\.teacherAdmin === true\)/);
|
||
|
|
assert.match(scorePage, /isManagerTeacher\.value \|\| String\(item\.createdBy \|\| ""\) === currentUserId\.value/);
|
||
|
|
assert.match(scorePage, /isManagerTeacher\.value \|\| String\(selectedTeachingClass\.value\.createdBy \|\| ""\) === currentUserId\.value/);
|
||
|
|
|
||
|
|
assert.match(reviewPage, /const filterTeachingClasses = \(classes\) =>/);
|
||
|
|
assert.match(reviewPage, /isManagerTeacher\.value \|\| String\(item\.createdBy \|\| ""\) === currentUserId\.value/);
|
||
|
|
assert.match(reviewPage, /isManagerTeacher\.value \|\| String\(currentClass\.createdBy \|\| ""\) === currentUserId\.value/);
|
||
|
|
|
||
|
|
assert.match(teacherHome, /const loadClasses = userStore\.userInfo\.teacherAdmin === true/);
|
||
|
|
assert.match(teacherHome, /teacherApi\.getAccessibleTeachingClasses/);
|
||
|
|
assert.match(teacherHome, /teacherApi\.getOwnedTeachingClasses/);
|
||
|
|
|
||
|
|
assert.match(examService, /where school_id=\? and \(status is null or status=1\)/);
|
||
|
|
assert.match(examService, /if \(!isTeacherAdmin\(teacher\)\)/);
|
||
|
|
assert.match(examService, /teacher_admin=1/);
|
||
|
|
|
||
|
|
console.log("teacher class dropdowns are scoped by owner with manager-teacher access");
|