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/student-demo-hash-routing.t...

13 lines
758 B
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const root = resolve(import.meta.dirname, "..");
const teacherTaskPage = readFileSync(resolve(root, "src/views/teacherEnd/trainingTask/index.vue"), "utf8");
const studentDemoPage = readFileSync(resolve(root, "src/views/studentDemo/index.vue"), "utf8");
assert.match(teacherTaskPage, /window\.open\("\/#\/student-demo", "_blank"\)/, "学生端讲解必须通过 Hash 路由打开演示入口");
assert.match(studentDemoPage, /window\.location\.replace\("\/#\/index"\)/, "兑换演示学生会话后必须通过 Hash 路由进入学生首页");
console.log("student demo uses hash routes instead of falling back to the teacher homepage");