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
+79
-9
@@ -26,12 +26,17 @@ describe("EmailTemplates", () => {
|
||||
const rendered = EmailTemplates.WELCOME_EMAIL.parse({
|
||||
appConfiguration,
|
||||
data: { name: "Ada", action_url: actionUrl },
|
||||
locale: "en",
|
||||
});
|
||||
|
||||
expect(rendered.subject).toBe("Welcome to Acme Portal, Ada!");
|
||||
expect(rendered.subject).toBe("Welcome to Acme Portal, Ada");
|
||||
expect(rendered.body).toContain(actionUrl);
|
||||
expect(rendered.body).toContain("Acme Portal");
|
||||
expect(rendered.body).toContain('<html lang="en">');
|
||||
expect(rendered.body.startsWith("<!DOCTYPE html>")).toBe(true);
|
||||
expect(rendered.text).toContain("Great to have you here, Ada");
|
||||
expect(rendered.text).toContain("Booked features unlock after payment is confirmed");
|
||||
expect(rendered.text).toContain("Continue setup");
|
||||
expect(rendered.data).toEqual({ name: "Ada", action_url: actionUrl });
|
||||
});
|
||||
|
||||
@@ -57,7 +62,7 @@ describe("EmailTemplates", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(rendered.subject).toBe("Grace invited you to Example Org on Acme Portal");
|
||||
expect(rendered.subject).toBe("Grace invited you to Example Org in Acme Portal");
|
||||
expect(rendered.body).toContain("Grace");
|
||||
expect(rendered.body).toContain("Example Org");
|
||||
expect(rendered.body).toContain(actionUrl);
|
||||
@@ -69,9 +74,57 @@ describe("EmailTemplates", () => {
|
||||
data: { name: "Ada", action_url: actionUrl },
|
||||
});
|
||||
|
||||
expect(rendered.subject).toBe("Verify your Acme Portal email address");
|
||||
expect(rendered.subject).toBe("Please confirm your email address");
|
||||
expect(rendered.body).toContain(actionUrl);
|
||||
expect(rendered.body).toMatch(/expires? in 30 minutes/i);
|
||||
expect(rendered.text).toContain("review your plan, add-ons, and payment method");
|
||||
expect(rendered.text).toContain("Features unlock only after payment is confirmed");
|
||||
expect(rendered.body).toContain("This confirmation link is valid for 24 hours");
|
||||
});
|
||||
|
||||
it("uses localized verification preview, expiry, outro and footer without English fallbacks", () => {
|
||||
const translations: Record<string, string> = {
|
||||
"emailVerification.subject": "Bestätige deine E-Mail-Adresse bei Acme Portal",
|
||||
"emailVerification.previewText": "E-Mail-Adresse bei Acme Portal bestätigen",
|
||||
"emailVerification.eyebrow": "E-Mail-Bestätigung",
|
||||
"emailVerification.title_named": "Danke fürs Anmelden, Ada!",
|
||||
"emailVerification.intro": "Bestätige deine E-Mail-Adresse, um die Einrichtung abzuschließen.",
|
||||
"emailVerification.actionLabel": "E-Mail bestätigen",
|
||||
"emailVerification.outro": "Wenn du diese Bestätigung nicht angefordert hast, kannst du diese E-Mail ignorieren.",
|
||||
"emailVerification.expiresText": "Dieser Bestätigungslink ist 24 Stunden gültig und kann nur einmal verwendet werden.",
|
||||
"common.signoff.closing": "Viele Grüße",
|
||||
"common.signoff.team": "Dein Acme-Team",
|
||||
"common.legal.privacyLabel": "Datenschutz",
|
||||
"common.legal.termsLabel": "AGB",
|
||||
"common.legal.imprintLabel": "Impressum",
|
||||
"common.legal.unsubscribeLabel": "Abmelden",
|
||||
"common.support.htmlBefore": "Bei Fragen kannst du uns gerne",
|
||||
"common.support.emailLinkLabel": "eine E-Mail schreiben",
|
||||
"common.support.htmlAfter": ".",
|
||||
};
|
||||
const rendered = EmailTemplates.VERIFICATION_EMAIL.parse({
|
||||
appConfiguration,
|
||||
data: { name: "Ada", action_url: actionUrl },
|
||||
t: (key) => translations[key] ?? key,
|
||||
locale: "de",
|
||||
});
|
||||
|
||||
expect(rendered.body).toContain("Dieser Bestätigungslink ist 24 Stunden gültig");
|
||||
expect(rendered.body).toContain("Wenn du diese Bestätigung nicht angefordert hast");
|
||||
expect(rendered.body).toContain("Datenschutz");
|
||||
expect(rendered.body).toContain('<html lang="de">');
|
||||
expect(rendered.body).not.toContain("This confirmation link");
|
||||
expect(rendered.body).not.toContain("If you did not request");
|
||||
});
|
||||
|
||||
it.each(["pl", "ru", "uk", "hu"] as const)("sets the React email document language to %s", (locale) => {
|
||||
const rendered = EmailTemplates.WELCOME_EMAIL.parse({
|
||||
appConfiguration,
|
||||
data: { name: "Ada", action_url: actionUrl },
|
||||
t: (key) => key,
|
||||
locale,
|
||||
});
|
||||
|
||||
expect(rendered.body).toContain(`<html lang="${locale}">`);
|
||||
});
|
||||
|
||||
it("renders account setup emails via the welcome template with plan-aware copy", () => {
|
||||
@@ -81,7 +134,7 @@ describe("EmailTemplates", () => {
|
||||
});
|
||||
|
||||
expect(rendered.subject).toBe("Finish setting up your Acme Portal account");
|
||||
expect(rendered.body).toContain("Pro plan");
|
||||
expect(rendered.body).toContain("Pro access");
|
||||
expect(rendered.body).toContain("ada@example.com");
|
||||
expect(rendered.body).toContain(actionUrl);
|
||||
});
|
||||
@@ -92,7 +145,7 @@ describe("EmailTemplates", () => {
|
||||
data: { action_url: actionUrl },
|
||||
});
|
||||
|
||||
expect(rendered.subject).toBe(`Welcome to ${defaultBrandTokens.productName}!`);
|
||||
expect(rendered.subject).toBe(`Welcome to ${defaultBrandTokens.productName}`);
|
||||
expect(rendered.body).toContain(defaultBrandTokens.productName);
|
||||
});
|
||||
|
||||
@@ -111,7 +164,15 @@ describe("EmailTemplates", () => {
|
||||
"welcome.title_named": `Hallo ${vars?.name}!`,
|
||||
"welcome.intro": `Danke fuer ${vars?.productName}.`,
|
||||
"welcome.actionLabel": "Einloggen",
|
||||
"common.signoff.thanks": "Danke,",
|
||||
"common.signoff.closing": "Viele Grüße",
|
||||
"common.signoff.team": "Dein Acme-Team",
|
||||
"common.legal.privacyLabel": "Datenschutz",
|
||||
"common.legal.termsLabel": "AGB",
|
||||
"common.legal.imprintLabel": "Impressum",
|
||||
"common.legal.unsubscribeLabel": "Abmelden",
|
||||
"common.support.htmlBefore": "Bei Fragen kannst du uns gerne",
|
||||
"common.support.emailLinkLabel": "eine E-Mail schreiben",
|
||||
"common.support.htmlAfter": ".",
|
||||
};
|
||||
return values[key] ?? key;
|
||||
},
|
||||
@@ -120,13 +181,22 @@ describe("EmailTemplates", () => {
|
||||
expect(withTranslator.subject).toBe("Willkommen bei Acme Portal, Ada!");
|
||||
expect(withTranslator.body).toContain("Hallo Ada!");
|
||||
expect(withTranslator.body).toContain("Einloggen");
|
||||
expect(withTranslator.body).toContain("Danke,");
|
||||
expect(withTranslator.body).toContain("Viele Grüße");
|
||||
expect(withTranslator.body).toContain("Dein Acme-Team");
|
||||
expect(withTranslator.body).toContain('<html lang="de">');
|
||||
expect(withTranslator.body).toContain("Datenschutz");
|
||||
expect(withTranslator.body).toContain("Bei Fragen kannst du uns gerne");
|
||||
expect(withTranslator.body).toContain("eine E-Mail schreiben");
|
||||
expect(withTranslator.body).not.toMatch(/<br\s*\/?>-<br\s*\/?>/u);
|
||||
expect(withTranslator.text).toContain("Hallo Ada!");
|
||||
expect(withTranslator.text).toContain("Datenschutz");
|
||||
expect(withTranslator.text).not.toContain("\n-\n");
|
||||
expect(withTranslator.body).not.toEqual(baseline.body);
|
||||
});
|
||||
|
||||
it("localizes registry descriptions when a mail translator is available", () => {
|
||||
const t = (key: string) => (key === "registry.welcomeDescription" ? "Lokalisierte Willkommensbeschreibung" : key);
|
||||
expect(EmailTemplates.WELCOME_EMAIL.describe(t)).toBe("Lokalisierte Willkommensbeschreibung");
|
||||
expect(EmailTemplates.WELCOME_EMAIL.description).toBe("Welcome email with login link");
|
||||
expect(EmailTemplates.WELCOME_EMAIL.description).toBe("Welcome email with setup link");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user