feat: add translations for emails and type error fixes overall (#994)
* feat: add translations for forgot password email and misc * fix: type fixes * feat: translate invitation email * fix: e2e tests * fix: lint * feat: type fixes and i18n for emails * Merge main * fix: jest import on server path * Merge * fix: playwright tests * fix: lint Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
1 parent
356d470e16
commit
8d6fec79d3
35 files changed
+680
-461
No files matched your search
@@ -2,22 +2,26 @@ import { expect, it } from "@jest/globals";
|
||||
|
||||
import { html, text, Invitation } from "@lib/emails/invitation";
|
||||
|
||||
import { getTranslation } from "@server/lib/i18n";
|
||||
|
||||
it("email text rendering should strip tags and add new lines", () => {
|
||||
const result = text("<p>hello world</p><br /><div>welcome to the brave <span>new</span> world");
|
||||
expect(result).toEqual("hello world\nwelcome to the brave new world");
|
||||
});
|
||||
|
||||
it("email html should render invite email", () => {
|
||||
it("email html should render invite email", async () => {
|
||||
const t = await getTranslation("en", "common");
|
||||
const invitation = {
|
||||
language: t,
|
||||
from: "Huxley",
|
||||
toEmail: "[email protected]",
|
||||
teamName: "Calendar Lovers",
|
||||
token: "invite-token",
|
||||
} as Invitation;
|
||||
const result = html(invitation);
|
||||
expect(result).toContain('<br />Huxley invited you to join the team "Calendar Lovers" in Cal.com.<br />');
|
||||
expect(result).toContain("/auth/signup?token=invite-token&");
|
||||
expect(result).toContain(
|
||||
'If you prefer not to use "[email protected]" as your Cal.com email or already have a Cal.com account, please request another invitation to that email.'
|
||||
`<br />${t("user_invited_you", { user: invitation.from, teamName: invitation.teamName })}<br />`
|
||||
);
|
||||
expect(result).toContain("/auth/signup?token=invite-token&");
|
||||
expect(result).toContain(`${t("request_another_invitation_email", { toEmail: invitation.toEmail })}`);
|
||||
});
|
||||
Reference in new issue
Block a user