From facf261bd6fe4a302b69c253a42dbb02aae79c85 Mon Sep 17 00:00:00 2001 From: que01 Date: Tue, 22 Sep 2026 23:26:10 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E9=AA=8C=E8=AF=81=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=BF=90=E8=A1=8C=E6=97=B6=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/test/http.integration.test.js | 31 ++++++++++++++++++++++++++ docs/template-runtime-progress.md | 1 + 2 files changed, 32 insertions(+) diff --git a/apps/api/test/http.integration.test.js b/apps/api/test/http.integration.test.js index 0df23ae..37d8a50 100644 --- a/apps/api/test/http.integration.test.js +++ b/apps/api/test/http.integration.test.js @@ -203,6 +203,37 @@ test("admin can customize workspace modules and fields with brand isolation", as } }); +test("admin visual template selection is reflected in public runtime workspace", async () => { + const login = await request("/admin/session/login", { + method: "POST", + payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD }, + }); + const token = JSON.parse(login.body).token; + const before = await request("/public/workspace"); + assert.equal(before.statusCode, 200); + const updated = await request("/admin/config/brand", { + method: "PATCH", + headers: { authorization: `Bearer ${token}` }, + payload: { config: { visualTemplateKey: "minimal-neutral" } }, + }); + assert.equal(updated.statusCode, 200); + try { + const runtime = await request("/public/workspace"); + assert.equal(runtime.statusCode, 200); + const body = JSON.parse(runtime.body); + assert.equal(body.visualTemplate.key, "minimal-neutral"); + assert.equal(body.visualTemplate.version, "1.0.0"); + assert.equal(body.theme.colors.accent, "#4B5563"); + assert.equal(body.visualTemplate.variants.hero, "minimal"); + } finally { + await request("/admin/config/brand", { + method: "PATCH", + headers: { authorization: `Bearer ${token}` }, + payload: { config: JSON.parse(before.body).brand?.config ?? {} }, + }); + } +}); + test("admin can create and version an inquiry form", async () => { const login = await request("/admin/session/login", { method: "POST", diff --git a/docs/template-runtime-progress.md b/docs/template-runtime-progress.md index 486b5a8..089079d 100644 --- a/docs/template-runtime-progress.md +++ b/docs/template-runtime-progress.md @@ -44,6 +44,7 @@ - [x] 建立行业模板与视觉模板注册表,并注册林境建筑画册与极简留白视觉模板。 - [x] Runtime Workspace 合并品牌配置中的视觉模板主题、版本和模块变体。 - [x] Admin 工作空间支持切换视觉模板并保存 `visualTemplateKey`。 +- [x] 集成测试验证视觉模板切换会影响公开 Runtime Workspace 的主题和变体。 - [ ] Phase 4:Capability Plugin。 - [ ] Phase 5:林境门作与第二行业双模板验证。 - [ ] Phase 6:Stitch 到 Manifest 的转换流水线。