feat: 完善模板字段编辑与分类治理

This commit is contained in:
que01 committed 2026-10-11 23:07:53 +08:00
1 parent 91322fa9a0
commit 26bcb2b66e
23 files changed
+631 -250

No files matched your search

+15 -9
View File
@@ -1034,14 +1034,6 @@ test("visual template compatibility is enforced by catalog, preview, and brand s
test("seeded public workspaces keep personal, food, and doors brands isolated", async () => {
const expected = [
{
slug: "linran-brand",
id: "00000000-0000-0000-0000-000000000003",
templateKey: "personal",
founder: "林然",
offeringKind: "service",
categoryLabel: "策略咨询",
},
{
slug: "default-brand",
id: "00000000-0000-0000-0000-000000000001",
@@ -1089,7 +1081,7 @@ test("seeded public workspaces keep personal, food, and doors brands isolated",
return workspace;
}),
);
assert.equal(new Set(workspaces.map((workspace) => workspace.brand.id)).size, 3);
assert.equal(new Set(workspaces.map((workspace) => workspace.brand.id)).size, 2);
});
test("public workspace uses brand-scoped capability installations and preserves status", async () => {
@@ -2207,6 +2199,20 @@ test("admin can manage offerings and public endpoint hides disabled offerings",
});
assert.equal(listed.statusCode, 200);
assert.ok(JSON.parse(listed.body).some((item) => item.id === id));
const withCategory = await request(`/admin/workspace/offerings/${id}`, {
method: "PATCH",
headers: { authorization: `Bearer ${token}` },
payload: { config: { categoryKey: "set-meal" } },
});
assert.equal(withCategory.statusCode, 200);
const preview = await request("/admin/workspace/preview", {
headers: { authorization: `Bearer ${token}` },
});
assert.equal(preview.statusCode, 200);
const draft = JSON.parse(preview.body);
const previewOffering = draft.offerings.find((item) => item.id === id);
assert.equal(previewOffering?.presentation?.categoryKey, "set-meal");
assert.equal(previewOffering?.presentation?.categoryLabel, "套餐");
const publicItem = await request(`/public/offerings/${id}`);
assert.equal(publicItem.statusCode, 400);
const publicList = await request("/public/offerings");