Files
YGChatCS/scripts/test-ParsedValueView-strict.mjs

44 lines
1.0 KiB
JavaScript

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");