Emails Revamp (#1201)
* refactor: emails (WIP) * wip * wip * refactor: calendarClient * chore: remove comment * feat: new templates * feat: more templates (wip) * feat: email templates wip * feat: email templates wip * feat: prepare for testing * For testing stripe integration * Uses imported BASE_URL * Fixes types * use BASE_URL Co-authored-by: Omar López <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
57 files changed
+4950
-2572
No files matched your search
@@ -1,27 +0,0 @@
|
||||
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", async () => {
|
||||
const t = await getTranslation("en", "common");
|
||||
const invitation = {
|
||||
language: t,
|
||||
from: "Huxley",
|
||||
toEmail: "hello@example.com",
|
||||
teamName: "Calendar Lovers",
|
||||
token: "invite-token",
|
||||
} as Invitation;
|
||||
const result = html(invitation);
|
||||
expect(result).toContain(
|
||||
`<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