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/teacher-owned-student-manag...

22 lines
1.8 KiB
JavaScript

const assert = require("assert");
const fs = require("fs");
const path = require("path");
const root = path.join(__dirname, "..");
const page = fs.readFileSync(path.join(root, "src", "views", "teacherEnd", "student", "index.vue"), "utf8");
const api = fs.readFileSync(path.join(root, "src", "api", "teacher.js"), "utf8");
assert(page.includes("operatorId: currentUserId.value"), "学生列表必须携带当前教师");
assert(page.includes("const isManagerTeacher = computed(() => userStore.userInfo.teacherAdmin === true);"), "教师管理员身份必须由当前登录账号识别");
assert(page.includes("const studentClassOptions = computed(() => teachingClassOptions.value);"), "学生筛选下拉框必须只展示教学班");
assert(page.includes("isManagerTeacher.value || sameValue(schoolClass.createdBy, currentUserId.value)"), "教师管理员必须可查看本校全部教学班");
assert(page.includes("const resolveRowTeachingClassId = (row) =>"), "未选择班级时操作必须从学生行解析教学班");
assert(page.includes('class="student-action-group"'), "学生操作按钮必须使用固定操作组布局");
assert(page.includes("flex-wrap: nowrap"), "学生操作按钮不得换行");
assert(!page.includes("仅查看</el-tag>"), "学生列表不应再展示仅查看操作");
assert(page.includes('["学生姓名", "学号", "班级"]'), "教学班导入模板必须包含班级列");
assert(!page.includes("请选择自己的教学班后再导入学生"), "按班级导入不应要求页面先选中教学班");
assert(api.includes('url: "/api/user/teaching-classes/students/import"'), "按班级导入必须调用新的上传接口");
assert(page.includes("initPassword(row, 1)"), "学生列表必须提供数据初始化操作");
console.log("teacher owned student management static checks passed");