Show Login and Ask an organizer sent and error states.
Connect the live modals to the drawn sent, expired, invalid-email, and send-failed screens, pin the phone footer above the keyboard, and send the light login email.
This commit is contained in:
1 parent
44010c7b73
commit
27d74e510c
29 files changed
+771
-281
No files matched your search
@@ -111,6 +111,7 @@ describe("POST /api/auth/magic-link/request", () => {
|
||||
expect(sendMagicLinkEmailMock).toHaveBeenCalledWith(
|
||||
"member@example.com",
|
||||
expect.stringContaining("/api/auth/magic-link/verify?token="),
|
||||
"https://x.test",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -130,6 +131,7 @@ describe("POST /api/auth/magic-link/request", () => {
|
||||
expect(sendMagicLinkEmailMock).toHaveBeenCalledWith(
|
||||
email,
|
||||
expect.stringContaining("/api/auth/magic-link/verify?token="),
|
||||
"https://x.test",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { MAGIC_LINK_TTL_MINUTES } from "../../lib/privacyRetention";
|
||||
import { buildMagicLinkMail } from "../../lib/server/magicLinkMail";
|
||||
|
||||
const VERIFY_URL =
|
||||
"https://communityrule.info/api/auth/magic-link/verify?token=abc";
|
||||
|
||||
describe("buildMagicLinkMail", () => {
|
||||
const mail = buildMagicLinkMail({
|
||||
verifyUrl: VERIFY_URL,
|
||||
origin: "https://communityrule.info",
|
||||
});
|
||||
|
||||
it("uses the drawn subject, once-and-minutes line, and log in button", () => {
|
||||
expect(mail.subject).toBe("Your login link for CommunityRule");
|
||||
expect(mail.previewText).toBe(
|
||||
`It works once, for ${MAGIC_LINK_TTL_MINUTES} minutes.`,
|
||||
);
|
||||
expect(mail.text).toContain("Log in to CommunityRule");
|
||||
expect(mail.text).toContain(VERIFY_URL);
|
||||
expect(mail.text).toContain(
|
||||
`It works once, for ${MAGIC_LINK_TTL_MINUTES} minutes.`,
|
||||
);
|
||||
expect(mail.html).toContain("background:#000000");
|
||||
expect(mail.html).toContain(">Log in</a>");
|
||||
expect(mail.html).toContain(`href="${VERIFY_URL}"`);
|
||||
expect(mail.html).toContain("/privacy");
|
||||
expect(mail.html).toContain("/about");
|
||||
});
|
||||
|
||||
it("does not invent a first name", () => {
|
||||
expect(mail.html).not.toContain("Hi ");
|
||||
expect(mail.text).not.toContain("Hi ");
|
||||
});
|
||||
});
|
||||
@@ -4,8 +4,8 @@ import { MAGIC_LINK_TTL_MINUTES } from "../../lib/privacyRetention";
|
||||
|
||||
describe("privacy retention copy", () => {
|
||||
it("states the login link lifetime in the sent state", () => {
|
||||
expect(login.successBody).toContain(
|
||||
`works for ${MAGIC_LINK_TTL_MINUTES} minutes`,
|
||||
);
|
||||
expect(
|
||||
login.sentBody.replace("{minutes}", String(MAGIC_LINK_TTL_MINUTES)),
|
||||
).toContain(`works for ${MAGIC_LINK_TTL_MINUTES} minutes`);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user