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/demand/consumer-behavior.vue"), "utf8" ); test("查看实训8通过应用路由在当前会话内打开目标用户画像", () => { assert.match(source, /import \{[^}]*useRouter[^}]*\} from "vue-router";/); assert.match(source, /const router = useRouter\(\);/); assert.match(source, /function viewTargetUserProfile\(\) \{\s*router\.push\(\{ path: "\/demand\/people" \}\);\s*\}/); assert.doesNotMatch(source, /window\.open\("\/demand\/people"/); }); test("查看实训8按钮在说明区右侧采用紧凑尺寸", () => { assert.match(source, /\.training-eight-action \{\s*grid-column: 2;\s*grid-row: 1;\s*justify-self: end;\s*min-width: 124px;\s*height: 38px;/); });