refactor: 退役运行时视觉模块并泛化模板门禁

This commit is contained in:
que01 committed 2026-09-26 22:30:26 +08:00
1 parent 25d1fe983c
commit e2e2340bfe
56 files changed
+290 -1037

No files matched your search

+5 -2
View File
@@ -21,7 +21,6 @@ function loadWithResponse(response) {
wx: storage,
require(id) {
if (id === "./request") return { request: () => Promise.resolve(response) };
if (id === "./module-registry") return { resolveRuntime: () => ({}) };
throw new Error(`意外依赖:${id}`);
},
});
@@ -44,17 +43,21 @@ test("已发布 workspace 正常返回", async () => {
assert.equal(workspace.brand.name, "测试品牌");
});
test("运行时只消费 canonical workspace 字段", async () => {
test("运行时保留模板业务数据,不再解释视觉模块", async () => {
const workspace = await loadWithResponse({
publication: { status: "published" },
brand: { name: "测试品牌" },
offerings: [],
trustPresentation: { bio: "品牌介绍" },
inquiryForms: [],
modules: [{ key: "brand-hero" }],
visualTemplateManifest: { pages: [] },
});
assert.deepEqual(workspace.trustContent, { bio: "品牌介绍" });
assert.equal(workspace.fields, undefined);
assert.equal(workspace.inquiryForm, undefined);
assert.equal(workspace.modules[0].key, "brand-hero");
assert.deepEqual(workspace.visualTemplateManifest, { pages: [] });
});
test("模板声明的业务提供项展示字段会保留在小程序 view model", async () => {