fix: Email for document update can include empty diff block

This commit is contained in:
Tom Moor
2023-07-07 08:23:42 -04:00
parent 814bacbead
commit 8cc2853102
3 changed files with 34 additions and 6 deletions

View File

@@ -113,6 +113,25 @@ same on both sides`,
expect(html).not.toContain("this is a highlight");
});
it("should return undefined if no diff is renderable", async () => {
const before = new Revision({
title: "Title",
text: `
This is a test paragraph`,
});
const after = new Revision({
title: "Title",
text: `
This is a [test paragraph](https://example.net)`,
});
// Note: This test may fail in the future when support for diffing marks
// is improved.
const html = await DocumentHelper.toEmailDiff(before, after);
expect(html).toBeUndefined();
});
it("should trim table rows to show minimal diff including header", async () => {
const before = new Revision({
title: "Title",