From 286aad2955371ea0388ef4e8a9c46d451db81ef6 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 23 Sep 2026 01:12:17 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E9=AA=8C=E8=AF=81=E9=97=A8=E7=AA=97?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=BF=90=E8=A1=8C=E6=97=B6=E5=A5=91=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/test/http.integration.test.js | 36 ++++++++++++++++++++++++++ docs/template-runtime-progress.md | 3 +++ 2 files changed, 39 insertions(+) diff --git a/apps/api/test/http.integration.test.js b/apps/api/test/http.integration.test.js index ea81f41..c28840a 100644 --- a/apps/api/test/http.integration.test.js +++ b/apps/api/test/http.integration.test.js @@ -151,6 +151,42 @@ test("admin capability list includes template defaults and brand overrides", asy await prisma.capabilityInstallation.deleteMany({ where: { brandId } }); }); +test("admin can install doors industry template through the shared runtime contract", async () => { + await prisma.inquirySubmission.deleteMany({ where: { brandId } }); + await prisma.inquiryForm.deleteMany({ where: { brandId } }); + await prisma.brandFieldDefinition.deleteMany({ where: { brandId } }); + await prisma.brandModule.deleteMany({ where: { brandId } }); + await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } }); + 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; + try { + const installed = await request("/admin/workspace/install", { + method: "POST", + headers: { authorization: `Bearer ${token}` }, + payload: { templateKey: "doors" }, + }); + assert.equal(installed.statusCode, 201); + assert.equal(JSON.parse(installed.body).template.key, "doors"); + const workspace = await request("/public/workspace"); + assert.equal(workspace.statusCode, 200); + const body = JSON.parse(workspace.body); + assert.equal(body.template.key, "doors"); + assert.ok(body.modules.some((item) => item.type === "offering")); + assert.ok(body.modules.some((item) => item.type === "inquiry")); + assert.deepEqual( + body.runtimeCapabilities.map((item) => item.key), + ["offerings", "inquiry"], + ); + } finally { + await prisma.brandFieldDefinition.deleteMany({ where: { brandId } }); + await prisma.brandModule.deleteMany({ where: { brandId } }); + await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } }); + } +}); + test("admin can install a template and public workspace exposes enabled configuration", async () => { await prisma.inquirySubmission.deleteMany({ where: { brandId } }); await prisma.inquiryForm.deleteMany({ where: { brandId } }); diff --git a/docs/template-runtime-progress.md b/docs/template-runtime-progress.md index ca51235..a064013 100644 --- a/docs/template-runtime-progress.md +++ b/docs/template-runtime-progress.md @@ -67,6 +67,9 @@ - [x] 增加 Admin 能力列表与状态更新接口,校验模板声明、品牌隔离和状态枚举。 - [x] 增加能力变更审计日志和授权 / 审计集成测试。 - [ ] Phase 5:林境门作与第二行业双模板验证。 +- [x] 注册 `doors@1.0.0` 门窗行业模板,复用个人品牌、信任、Offering 与 Inquiry 能力。 +- [x] 增加门窗行业 fixture,并验证 Admin 安装后 Runtime Workspace 契约完整。 +- [ ] 补充门窗真实 Offering、信任内容和咨询字段数据 fixture。 - [ ] Phase 6:Stitch 到 Manifest 的转换流水线。 ## 当前交付门槛