fix: 完善工坊模板安装预览与详情样例
This commit is contained in:
1 parent
5313fd9d32
commit
50753db79d
16 files changed
+496
-26
No files matched your search
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { after, before, test } from "node:test";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { getVisualTemplateManifest } from "@personal-brand/config";
|
||||
import { createApp } from "../dist/main.js";
|
||||
import { readIdentity, signIdentity } from "../dist/auth.js";
|
||||
import { WechatAuthService } from "../dist/wechat-auth.js";
|
||||
@@ -1189,6 +1190,12 @@ test("visual template compatibility is enforced by catalog, preview, and brand s
|
||||
const catalog = await request("/public/templates");
|
||||
assert.equal(catalog.statusCode, 200);
|
||||
const visuals = JSON.parse(catalog.body).visuals;
|
||||
for (const visual of visuals) {
|
||||
const manifest = getVisualTemplateManifest(visual.key);
|
||||
assert.ok(manifest, `Catalog visual must be installable: ${visual.key}`);
|
||||
assert.equal(manifest.key, visual.key);
|
||||
assert.deepEqual(manifest.supportedIndustryTemplates, visual.supportedIndustryTemplates);
|
||||
}
|
||||
assert.deepEqual(
|
||||
visuals.find((visual) => visual.key === "linjing-editorial").supportedIndustryTemplates,
|
||||
["personal", "doors"],
|
||||
@@ -3468,7 +3475,7 @@ test("atelier template imports selected package and preserves draft publication
|
||||
tagline: "独立开发者 · 品牌小程序构建",
|
||||
description: "专注个人品牌表达、内容管理与咨询承接。",
|
||||
config: {
|
||||
visualTemplateKey: "atelier-solopreneur",
|
||||
visualTemplateKey: "linjing-editorial",
|
||||
founder: "验收主理人",
|
||||
title: "产品设计 / 全栈开发",
|
||||
visualPresentation: { home: { subtitle: "保留已有品牌说明" } },
|
||||
@@ -3501,6 +3508,18 @@ test("atelier template imports selected package and preserves draft publication
|
||||
403,
|
||||
);
|
||||
}
|
||||
await json("/admin/config/brand", {
|
||||
method: "PATCH",
|
||||
headers,
|
||||
payload: { config: { visualTemplateKey: "atelier-solopreneur" } },
|
||||
});
|
||||
const installation = await json("/admin/workspace/install", {
|
||||
method: "POST",
|
||||
headers,
|
||||
payload: { templateKey: "personal" },
|
||||
});
|
||||
assert.equal(installation.visualTemplate.key, "atelier-solopreneur");
|
||||
assert.equal(installation.visualTemplate.tokens.colors.accent, "#183329");
|
||||
const preview = await json("/admin/workspace/sample-content/preview", { headers });
|
||||
assert.equal(preview.counts.fields, 5);
|
||||
await json("/admin/workspace/sample-content/import", { method: "POST", headers });
|
||||
@@ -3523,6 +3542,16 @@ test("atelier template imports selected package and preserves draft publication
|
||||
where: { brandId: brand.id },
|
||||
});
|
||||
assert.match(exampleOffering.coverUrl, /^\/assets\/cases\//);
|
||||
const sampleRuntime = await json("/admin/workspace/preview", { headers });
|
||||
for (const item of sampleRuntime.offerings) {
|
||||
assert.equal(item.presentation.categoryLabel, "案例展示");
|
||||
assert.equal(item.priceText, "按需求确认范围与报价");
|
||||
assert.ok(item.presentation.spaceType);
|
||||
assert.ok(item.presentation.details.background);
|
||||
assert.ok(item.presentation.details.designConcept);
|
||||
assert.ok(item.presentation.details.crafts.length);
|
||||
assert.ok(item.presentation.details.materialsList.length);
|
||||
}
|
||||
const offeringFields = [
|
||||
...new Map(
|
||||
manifest.admin.sections
|
||||
|
||||
Reference in new issue
Block a user