39 行
1.5 KiB
JavaScript
39 行
1.5 KiB
JavaScript
import assert from "node:assert/strict"
|
|
import { readFile } from "node:fs/promises"
|
|
import test from "node:test"
|
|
|
|
const appPath = new URL("../standalone-web/src/App.vue", import.meta.url)
|
|
const materialDialogPath = new URL(
|
|
"../standalone-web/src/components/MaterialDetailDialog.vue",
|
|
import.meta.url,
|
|
)
|
|
|
|
test("production UI never injects disconnected demo images, profiles, materials, or models", async () => {
|
|
const [app, materialDialog] = await Promise.all([
|
|
readFile(appPath, "utf8"),
|
|
readFile(materialDialogPath, "utf8"),
|
|
])
|
|
|
|
for (const forbidden of [
|
|
"mockGenerateImageSeeds",
|
|
"mockGenerateImages",
|
|
"quickProfileSampleProfiles",
|
|
'source: "sample"',
|
|
"mock://",
|
|
"示例素材",
|
|
"预览模型",
|
|
"IMAGESTUDIO TEST",
|
|
"星港夜巡",
|
|
"雾岛未花",
|
|
]) {
|
|
assert.equal(app.includes(forbidden), false, `App.vue still contains production demo data: ${forbidden}`)
|
|
assert.equal(materialDialog.includes(forbidden), false, `Material dialog still contains demo data: ${forbidden}`)
|
|
}
|
|
|
|
assert.match(app, /const imageGenerationImages[\s\S]*localGenerationImages\.value\.filter\(isAuthenticGenerationImage\)/)
|
|
assert.match(app, /const rawMaterialLibraryCards[\s\S]*backendItems\.map/)
|
|
assert.match(app, /const profilePageItems = computed<CharacterProfile\[\]>\(\(\) => backendProfiles\.value\)/)
|
|
assert.match(app, /后端未连接/)
|
|
assert.match(app, /IMAGESTUDIO · 未生成/)
|
|
assert.match(materialDialog, /无缩略图/)
|
|
})
|