fix(email-renderer): preserve fallbacks when AMP validation is unavailable
This commit is contained in:
1 parent
2f735b267b
commit
42b91f765d
3 files changed
+30
-3
No files matched your search
@@ -57,6 +57,17 @@ const document: BlockDocument = {
|
||||
};
|
||||
|
||||
describe("email renderer", () => {
|
||||
test("optional AMP validation failures preserve HTML/text fallbacks", async () => {
|
||||
for (const ampValidator of [async () => {throw new Error("network unavailable")}, () => new Promise<never>(() => {})]) {
|
||||
const result=await renderEmail(document,{amp:true,ampValidator,ampValidationTimeoutMs:10});
|
||||
expect(result.ok).toBe(true);
|
||||
if(!result.ok)continue;
|
||||
expect(result.value.parts.amp).toBeUndefined();
|
||||
expect(result.value.parts.html.content).toContain("Hello <world>");
|
||||
expect(result.value.parts.text.content).toContain("Hello <world>");
|
||||
expect(result.value.warnings.some(item=>item.code==="amp.validatorUnavailable"&&item.severity==="warning")).toBe(true);
|
||||
}
|
||||
});
|
||||
test("builder column rows export without nesting mj-column inside mj-column", async () => {
|
||||
for (const count of [1,2,3,4]) {
|
||||
const draft=structuredClone(document);
|
||||
|
||||
Reference in new issue
Block a user