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.
17 lines
926 B
JavaScript
17 lines
926 B
JavaScript
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, /<img\s+:src="resolveUploadedImageUrl\(image\.url\)"/);
|
|
assert.match(source, /function previewStepTwoImage\(url\)\s*\{\s*imagePreviewUrl\.value\s*=\s*resolveUploadedImageUrl\(url\)/);
|
|
});
|
|
|
|
test("实训一第二步将旧 localhost 文件地址转换为文件服务路径", () => {
|
|
assert.match(source, /function resolveUploadedImageUrl\(url\)[\s\S]*?new URL\(source\)[\s\S]*?localhost[\s\S]*?return `\$\{parsed\.pathname\}\$\{parsed\.search\}\$\{parsed\.hash\}`/);
|
|
});
|