Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+48
-9
@@ -1,14 +1,35 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import {
|
||||
reactTransactionalTemplateNames,
|
||||
renderTransactionalEmail,
|
||||
withBrandDefaults,
|
||||
} from "./render.js";
|
||||
import { createBrandTokens } from "@hivegrid/brand";
|
||||
import { buildBrand, reactTransactionalTemplateNames, renderTransactionalEmail, withBrandDefaults } from "./render.js";
|
||||
|
||||
const brand = withBrandDefaults();
|
||||
|
||||
describe("renderTransactionalEmail", () => {
|
||||
test("exposes all 8 template names", () => {
|
||||
test("maps nested brand tokens and locks the HiveGrid platform identity", () => {
|
||||
const mapped = buildBrand(
|
||||
createBrandTokens({
|
||||
productName: "Tenant Portal",
|
||||
siteUrl: "https://tenant.example.test",
|
||||
legal: {
|
||||
privacyUrl: "https://tenant.example.test/privacy",
|
||||
termsUrl: "https://tenant.example.test/terms",
|
||||
imprintUrl: "https://tenant.example.test/imprint",
|
||||
},
|
||||
assets: { logoUrl: "https://tenant.example.test/logo.png" },
|
||||
mail: { colors: { primary: "#123456" } },
|
||||
})
|
||||
);
|
||||
|
||||
expect(mapped.productName).toBe("Tenant Portal");
|
||||
expect(mapped.primaryColor).toBe("#123456");
|
||||
expect(mapped.logoUrl).toBe("https://hivegrid.de/hivegrid-logo.png");
|
||||
expect(mapped.siteUrl).toBe("https://hivegrid.de");
|
||||
expect(mapped.privacyUrl).toBe("https://hivegrid.de/datenschutz");
|
||||
expect(mapped.termsUrl).toBe("https://hivegrid.de/agb");
|
||||
expect(mapped.imprintUrl).toBe("https://hivegrid.de/impressum");
|
||||
});
|
||||
|
||||
test("exposes all 9 template names", () => {
|
||||
const names = reactTransactionalTemplateNames();
|
||||
expect(names).toEqual([
|
||||
"welcome",
|
||||
@@ -18,6 +39,7 @@ describe("renderTransactionalEmail", () => {
|
||||
"subscription-success",
|
||||
"subscription-failed",
|
||||
"invoice-sent",
|
||||
"system-message",
|
||||
"tenant-notification",
|
||||
]);
|
||||
});
|
||||
@@ -43,10 +65,27 @@ describe("renderTransactionalEmail", () => {
|
||||
expect(result.text).toContain("Join Example Org");
|
||||
});
|
||||
|
||||
test("renders a structured system message in HTML and plaintext", () => {
|
||||
const result = renderTransactionalEmail("system-message", {
|
||||
brand,
|
||||
subject: "Appointment confirmed",
|
||||
eyebrow: "Appointment",
|
||||
title: "We look forward to seeing you",
|
||||
intro: "Your appointment is confirmed.",
|
||||
actionUrl: "https://app.example.com/bookings/42",
|
||||
actionLabel: "View appointment",
|
||||
details: [{ label: "Date", value: "17 June 2026, 10:00" }],
|
||||
});
|
||||
expect(result.html).toContain("https://hivegrid.de/hivegrid-logo.png");
|
||||
expect(result.html).toContain("View appointment");
|
||||
expect(result.text).toContain("Date");
|
||||
expect(result.text).toContain("17 June 2026, 10:00");
|
||||
});
|
||||
|
||||
test("throws on unknown template", () => {
|
||||
expect(() =>
|
||||
renderTransactionalEmail("unknown" as Parameters<typeof renderTransactionalEmail>[0], {} as never)
|
||||
).toThrow(/Unknown React transactional template/);
|
||||
expect(() => renderTransactionalEmail("unknown" as Parameters<typeof renderTransactionalEmail>[0], {} as never)).toThrow(
|
||||
/Unknown React transactional template/
|
||||
);
|
||||
});
|
||||
|
||||
test("returns html with <!DOCTYPE html> prefix for SSR mode", () => {
|
||||
|
||||
Reference in new issue
Block a user