refactor: 退役运行时视觉模块并泛化模板门禁
This commit is contained in:
1 parent
25d1fe983c
commit
e2e2340bfe
56 files changed
+290
-1037
No files matched your search
@@ -320,7 +320,6 @@ test("health and public content are available without authentication", async ()
|
||||
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));
|
||||
@@ -675,7 +674,6 @@ test("admin can install doors industry template through the shared runtime contr
|
||||
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",
|
||||
@@ -702,7 +700,6 @@ test("admin can install doors industry template through the shared runtime contr
|
||||
assert.equal(JSON.parse(samplePreview.body).templateKey, "doors");
|
||||
} finally {
|
||||
await prisma.brandFieldDefinition.deleteMany({ where: { brandId } });
|
||||
await prisma.brandModule.deleteMany({ where: { brandId } });
|
||||
await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } });
|
||||
}
|
||||
});
|
||||
@@ -770,7 +767,6 @@ test("admin can install a template and public workspace exposes enabled configur
|
||||
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",
|
||||
@@ -839,14 +835,13 @@ test("admin can install a template and public workspace exposes enabled configur
|
||||
const workspaceBody = JSON.parse(publicWorkspace.body);
|
||||
assert.equal(workspaceBody.contractVersion, "1.0");
|
||||
assert.equal(workspaceBody.template.key, "food");
|
||||
assert.ok(workspaceBody.modules.length > 0);
|
||||
assert.equal("templateContent" in workspaceBody, false);
|
||||
assert.equal("runtimeModules" in workspaceBody, false);
|
||||
assert.equal("runtimeCapabilities" in workspaceBody, false);
|
||||
assert.equal("fields" in workspaceBody, false);
|
||||
assert.equal("trustContent" in workspaceBody, false);
|
||||
assert.equal("inquiryForm" in workspaceBody, false);
|
||||
assert.equal(workspaceBody.modules[0].schemaVersion, "1.0");
|
||||
assert.equal("modules" in workspaceBody, false);
|
||||
assert.ok(workspaceBody.inquiryForms.length > 0);
|
||||
const conflict = await request("/admin/workspace/install", {
|
||||
method: "POST",
|
||||
@@ -856,14 +851,12 @@ test("admin can install a template and public workspace exposes enabled configur
|
||||
assert.equal(conflict.statusCode, 400);
|
||||
} finally {
|
||||
await prisma.brandFieldDefinition.deleteMany({ where: { brandId } });
|
||||
await prisma.brandModule.deleteMany({ where: { brandId } });
|
||||
await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } });
|
||||
}
|
||||
});
|
||||
|
||||
test("admin can customize workspace modules and fields with brand isolation", async () => {
|
||||
test("admin can customize workspace fields with brand isolation", async () => {
|
||||
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",
|
||||
@@ -879,19 +872,12 @@ test("admin can customize workspace modules and fields with brand isolation", as
|
||||
const workspace = await request("/admin/workspace", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
const moduleId = JSON.parse(workspace.body).modules[0].id;
|
||||
const invalidField = await request("/admin/workspace/fields", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { scope: "unknown", key: "Bad-Key", label: "非法字段", type: "text" },
|
||||
});
|
||||
assert.equal(invalidField.statusCode, 400);
|
||||
const updatedModule = await request(`/admin/workspace/modules/${moduleId}`, {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: { title: "我的品牌介绍", isEnabled: false },
|
||||
});
|
||||
assert.equal(updatedModule.statusCode, 200);
|
||||
const createdField = await request("/admin/workspace/fields", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
@@ -919,7 +905,6 @@ test("admin can customize workspace modules and fields with brand isolation", as
|
||||
assert.equal(deletedField.statusCode, 200);
|
||||
} finally {
|
||||
await prisma.brandFieldDefinition.deleteMany({ where: { brandId } });
|
||||
await prisma.brandModule.deleteMany({ where: { brandId } });
|
||||
await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user