feat: 建立组件化模板预览基线并规划可视化编辑
This commit is contained in:
1 parent
c5af790554
commit
0b14b5a814
46 files changed
+1880
-427
No files matched your search
@@ -1325,6 +1325,28 @@ test("admin can install a template and public workspace exposes enabled configur
|
||||
}
|
||||
});
|
||||
|
||||
test("admin preview workspace is brand-scoped and exposes only the published runtime", async () => {
|
||||
const user = await prisma.adminUser.findUniqueOrThrow({ where: { username: "admin" } });
|
||||
const token = signIdentity({ subject: user.id, brandId, role: "admin" });
|
||||
const unauthorized = await request("/admin/workspace/preview");
|
||||
assert.equal(unauthorized.statusCode, 401);
|
||||
const wrongRole = await request("/admin/workspace/preview", {
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
});
|
||||
assert.equal(wrongRole.statusCode, 403);
|
||||
const authorized = await request("/admin/workspace/preview", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(authorized.statusCode, 200);
|
||||
const workspace = JSON.parse(authorized.body);
|
||||
assert.equal(workspace.publication?.status, "published");
|
||||
assert.equal(
|
||||
workspace.brand.slug,
|
||||
(await prisma.brandProfile.findUniqueOrThrow({ where: { id: brandId } })).slug,
|
||||
);
|
||||
assert.equal(workspace.brand.visualTemplateKey, "acheng-campus-food");
|
||||
});
|
||||
|
||||
test("admin can customize workspace fields with brand isolation", async () => {
|
||||
await prisma.brandFieldDefinition.deleteMany({ where: { brandId } });
|
||||
await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } });
|
||||
|
||||
Reference in new issue
Block a user