const assert = require("node:assert/strict"); const fs = require("node:fs"); const path = require("node:path"); const test = require("node:test"); const source = fs.readFileSync(path.join(__dirname, "../src/views/foundation/new-product-survey.vue"), "utf8"); test("实训一第二步的上传图片使用可访问地址预览", () => { assert.match(source, /import\s*\{\s*isExternal\s*\}\s*from\s*["']@\/utils\/validate["']/); assert.match(source, / { assert.match(source, /function resolveUploadedImageUrl\(url\)[\s\S]*?new URL\(source\)[\s\S]*?localhost[\s\S]*?return `\$\{parsed\.pathname\}\$\{parsed\.search\}\$\{parsed\.hash\}`/); });