test: 验证门窗模板运行时契约
This commit is contained in:
1 parent
041a6a7f02
commit
286aad2955
2 files changed
+39
No files matched your search
@@ -151,6 +151,42 @@ test("admin capability list includes template defaults and brand overrides", asy
|
|||||||
await prisma.capabilityInstallation.deleteMany({ where: { brandId } });
|
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 () => {
|
test("admin can install a template and public workspace exposes enabled configuration", async () => {
|
||||||
await prisma.inquirySubmission.deleteMany({ where: { brandId } });
|
await prisma.inquirySubmission.deleteMany({ where: { brandId } });
|
||||||
await prisma.inquiryForm.deleteMany({ where: { brandId } });
|
await prisma.inquiryForm.deleteMany({ where: { brandId } });
|
||||||
|
|||||||
@@ -67,6 +67,9 @@
|
|||||||
- [x] 增加 Admin 能力列表与状态更新接口,校验模板声明、品牌隔离和状态枚举。
|
- [x] 增加 Admin 能力列表与状态更新接口,校验模板声明、品牌隔离和状态枚举。
|
||||||
- [x] 增加能力变更审计日志和授权 / 审计集成测试。
|
- [x] 增加能力变更审计日志和授权 / 审计集成测试。
|
||||||
- [ ] Phase 5:林境门作与第二行业双模板验证。
|
- [ ] Phase 5:林境门作与第二行业双模板验证。
|
||||||
|
- [x] 注册 `doors@1.0.0` 门窗行业模板,复用个人品牌、信任、Offering 与 Inquiry 能力。
|
||||||
|
- [x] 增加门窗行业 fixture,并验证 Admin 安装后 Runtime Workspace 契约完整。
|
||||||
|
- [ ] 补充门窗真实 Offering、信任内容和咨询字段数据 fixture。
|
||||||
- [ ] Phase 6:Stitch 到 Manifest 的转换流水线。
|
- [ ] Phase 6:Stitch 到 Manifest 的转换流水线。
|
||||||
|
|
||||||
## 当前交付门槛
|
## 当前交付门槛
|
||||||
|
|||||||
Reference in new issue
Block a user