test: 隔离示例内容测试数据

This commit is contained in:
que01 committed 2026-09-25 17:17:12 +08:00
1 parent 9b61047ec6
commit c46297b13b
1 file changed
+10
+10
View File
@@ -709,6 +709,9 @@ test("admin can install doors industry template through the shared runtime contr
test("admin can preview and import sample content idempotently", async () => {
const originalBrand = await prisma.brandProfile.findUnique({ where: { id: brandId } });
const originalSampleTrust = await prisma.trustContent.findMany({
where: { brandId, content: "示例内容,待品牌主理人完善。" },
});
await prisma.brandProfile.update({ where: { id: brandId }, data: { templateKey: "doors" } });
await prisma.offering.deleteMany({
where: {
@@ -748,6 +751,13 @@ test("admin can preview and import sample content idempotently", async () => {
await prisma.trustContent.deleteMany({
where: { brandId, content: "示例内容,待品牌主理人完善。" },
});
if (originalSampleTrust.length) {
await prisma.trustContent.createMany({
data: originalSampleTrust.map(
({ id: _id, createdAt: _createdAt, updatedAt: _updatedAt, ...item }) => item,
),
});
}
await prisma.brandFieldDefinition.deleteMany({ where: { brandId, source: "sample" } });
await prisma.capabilityAuditLog.deleteMany({ where: { brandId, capabilityKey: "doors" } });
await prisma.brandProfile.update({