test: 验证运行时工作空间公开契约
This commit is contained in:
1 parent
f9ca5b1fea
commit
53ee034db8
3 files changed
+14
No files matched your search
@@ -147,6 +147,7 @@ export class PublicWorkspaceController {
|
||||
config: this.jsonObject(module.config),
|
||||
source:
|
||||
module.source === "custom" ? "custom" : module.source === "template" ? "template" : "core",
|
||||
schemaVersion: "1.0",
|
||||
}));
|
||||
const runtimeOfferings: RuntimeOffering[] = offerings.map((item) => {
|
||||
const config = this.jsonObject(item.config);
|
||||
|
||||
@@ -46,6 +46,17 @@ test("health and public content are available without authentication", async ()
|
||||
assert.ok(JSON.parse(services.body).length >= 3);
|
||||
const removedServicesRoute = await request("/public/services");
|
||||
assert.equal(removedServicesRoute.statusCode, 404);
|
||||
|
||||
const workspace = await request("/public/workspace");
|
||||
assert.equal(workspace.statusCode, 200);
|
||||
const runtime = JSON.parse(workspace.body);
|
||||
assert.equal(runtime.schemaVersion, "1.0.0");
|
||||
assert.ok(Array.isArray(runtime.navigation.tabs));
|
||||
assert.ok(Array.isArray(runtime.modules));
|
||||
assert.ok(Array.isArray(runtime.offerings));
|
||||
assert.ok(Array.isArray(runtime.inquiryForms));
|
||||
assert.ok(Array.isArray(runtime.capabilities));
|
||||
assert.ok(runtime.theme.colors.background);
|
||||
});
|
||||
|
||||
test("admin can install a template and public workspace exposes enabled configuration", async () => {
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
- [x] 新增模板声明的基础校验函数。
|
||||
- [x] 在 API 增加运行时工作空间公开接口字段(`/public/workspace`)。
|
||||
- [x] API 工作空间输出统一导航、模块、Offering、表单和能力结构。
|
||||
- [x] 增加公开工作空间契约结构测试。
|
||||
- [x] 集成测试覆盖运行时 schemaVersion、导航、模块、Offering、表单、能力和主题。
|
||||
- [ ] 增加 API 授权、品牌隔离和 schema 版本测试。
|
||||
- [ ] 让 Admin 与小程序读取同一运行时契约。
|
||||
|
||||
|
||||
Reference in new issue
Block a user