feat: 改造了组件的渲染逻辑
This commit is contained in:
43
scripts/test-ParsedValueView-strict.mjs
Normal file
43
scripts/test-ParsedValueView-strict.mjs
Normal file
@@ -0,0 +1,43 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
const source = await readFile(
|
||||
resolve("src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue"),
|
||||
"utf8"
|
||||
);
|
||||
|
||||
const forbiddenCompatibilitySnippets = [
|
||||
"valueObj.image_url",
|
||||
"valueObj.image,",
|
||||
"valueObj.image_id",
|
||||
"valueObj.content_image",
|
||||
"valueObj.sopt_name",
|
||||
"valueObj.name",
|
||||
"valueObj.title",
|
||||
"valueObj.sopt_description",
|
||||
"valueObj.description",
|
||||
"valueObj.desc",
|
||||
"valueObj.sopt_longitude",
|
||||
"valueObj.longitude",
|
||||
"valueObj.lng",
|
||||
"valueObj.sopt_latitude",
|
||||
"valueObj.latitude",
|
||||
"valueObj.lat",
|
||||
"valueObj.sopt_tag",
|
||||
"valueObj.tag",
|
||||
"valueObj.type",
|
||||
"value?.questions",
|
||||
"value?.items",
|
||||
"value?.list",
|
||||
];
|
||||
|
||||
for (const snippet of forbiddenCompatibilitySnippets) {
|
||||
assert.equal(
|
||||
source.includes(snippet),
|
||||
false,
|
||||
`ParsedValueView should not guess compatibility field: ${snippet}`
|
||||
);
|
||||
}
|
||||
|
||||
console.log("ParsedValueView strict field checks passed");
|
||||
Reference in New Issue
Block a user