test: 隔离示例内容测试数据
This commit is contained in:
1 parent
9b61047ec6
commit
c46297b13b
1 file changed
+10
@@ -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 () => {
|
test("admin can preview and import sample content idempotently", async () => {
|
||||||
const originalBrand = await prisma.brandProfile.findUnique({ where: { id: brandId } });
|
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.brandProfile.update({ where: { id: brandId }, data: { templateKey: "doors" } });
|
||||||
await prisma.offering.deleteMany({
|
await prisma.offering.deleteMany({
|
||||||
where: {
|
where: {
|
||||||
@@ -748,6 +751,13 @@ test("admin can preview and import sample content idempotently", async () => {
|
|||||||
await prisma.trustContent.deleteMany({
|
await prisma.trustContent.deleteMany({
|
||||||
where: { brandId, content: "示例内容,待品牌主理人完善。" },
|
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.brandFieldDefinition.deleteMany({ where: { brandId, source: "sample" } });
|
||||||
await prisma.capabilityAuditLog.deleteMany({ where: { brandId, capabilityKey: "doors" } });
|
await prisma.capabilityAuditLog.deleteMany({ where: { brandId, capabilityKey: "doors" } });
|
||||||
await prisma.brandProfile.update({
|
await prisma.brandProfile.update({
|
||||||
|
|||||||
Reference in new issue
Block a user