test: 补齐跨模板发布回归
This commit is contained in:
1 parent
0c5ff79b42
commit
34b872a84c
6 files changed
+231
-9
No files matched your search
@@ -74,6 +74,145 @@ test("admin release lifecycle is authorized, brand-scoped, and versioned", async
|
||||
JSON.parse(doorsReadiness.body).checks.find((check) => check.key === "forms")?.passed,
|
||||
true,
|
||||
);
|
||||
const doorsReadinessBody = JSON.parse(doorsReadiness.body);
|
||||
assert.equal(
|
||||
doorsReadinessBody.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
doorsReadinessBody.checks.find((check) => check.key === "trust:credential")?.passed,
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
doorsReadinessBody.checks.some((check) => check.key === "trust:schedule"),
|
||||
false,
|
||||
);
|
||||
const doorsProcessTrust = await prisma.trustContent.findFirstOrThrow({
|
||||
where: { brandId: "00000000-0000-0000-0000-000000000002", type: "process", isPublished: true },
|
||||
});
|
||||
const originalDoorsProcessTrust = {
|
||||
isPublished: doorsProcessTrust.isPublished,
|
||||
title: doorsProcessTrust.title,
|
||||
content: doorsProcessTrust.content,
|
||||
};
|
||||
try {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: { isPublished: false },
|
||||
});
|
||||
const unpublishedDoors = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(unpublishedDoors.ready, false);
|
||||
assert.equal(
|
||||
unpublishedDoors.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: { isPublished: true, title: " " },
|
||||
});
|
||||
const blankDoorsTitle = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(blankDoorsTitle.ready, false);
|
||||
assert.equal(
|
||||
blankDoorsTitle.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: { title: originalDoorsProcessTrust.title, content: " \n " },
|
||||
});
|
||||
const blankDoorsContent = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(blankDoorsContent.ready, false);
|
||||
assert.equal(
|
||||
blankDoorsContent.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: originalDoorsProcessTrust,
|
||||
});
|
||||
const restoredDoors = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(restoredDoors.checks.find((check) => check.key === "trust:process")?.passed, true);
|
||||
} finally {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: originalDoorsProcessTrust,
|
||||
});
|
||||
}
|
||||
const doorsCredentialTrust = await prisma.trustContent.findFirstOrThrow({
|
||||
where: {
|
||||
brandId: "00000000-0000-0000-0000-000000000002",
|
||||
type: "credential",
|
||||
isPublished: true,
|
||||
},
|
||||
});
|
||||
const originalDoorsCredentialTrust = {
|
||||
isPublished: doorsCredentialTrust.isPublished,
|
||||
title: doorsCredentialTrust.title,
|
||||
content: doorsCredentialTrust.content,
|
||||
};
|
||||
try {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsCredentialTrust.id },
|
||||
data: { isPublished: false },
|
||||
});
|
||||
const missingDoorsCredential = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(missingDoorsCredential.ready, false);
|
||||
assert.equal(
|
||||
missingDoorsCredential.checks.find((check) => check.key === "trust:credential")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsCredentialTrust.id },
|
||||
data: { isPublished: true, content: " \n " },
|
||||
});
|
||||
const blankDoorsCredential = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(blankDoorsCredential.ready, false);
|
||||
assert.equal(
|
||||
blankDoorsCredential.checks.find((check) => check.key === "trust:credential")?.passed,
|
||||
false,
|
||||
);
|
||||
} finally {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsCredentialTrust.id },
|
||||
data: originalDoorsCredentialTrust,
|
||||
});
|
||||
}
|
||||
const enabledForms = await prisma.inquiryForm.findMany({
|
||||
where: { brandId, isEnabled: true },
|
||||
select: { id: true },
|
||||
|
||||
Reference in new issue
Block a user