GET still shows a one-button page, a used invitation can resend or reopen for the signed-in invitee, and an email-change GET no longer signs the account out.
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
emailChangeConfirmPath,
|
|
emailChangeVerifyPath,
|
|
inviteConfirmPath,
|
|
inviteVerifyPath,
|
|
magicLinkConfirmPath,
|
|
magicLinkVerifyPath,
|
|
} from "../../lib/create/confirmLinkPaths";
|
|
|
|
describe("confirmLinkPaths", () => {
|
|
it("encodes tokens on confirm and verify URLs", () => {
|
|
expect(magicLinkConfirmPath("a+b")).toBe("/login/confirm?token=a%2Bb");
|
|
expect(magicLinkVerifyPath("a+b")).toBe(
|
|
"/api/auth/magic-link/verify?token=a%2Bb",
|
|
);
|
|
expect(emailChangeConfirmPath("a+b")).toBe(
|
|
"/email-change/confirm?token=a%2Bb",
|
|
);
|
|
expect(emailChangeVerifyPath("a+b")).toBe(
|
|
"/api/user/email-change/verify?token=a%2Bb",
|
|
);
|
|
});
|
|
|
|
it("keeps copy=1 on invitation confirm and verify URLs", () => {
|
|
expect(inviteConfirmPath("abc1234567", { copy: true })).toBe(
|
|
"/invite/confirm?token=abc1234567©=1",
|
|
);
|
|
expect(inviteVerifyPath("abc1234567", { copy: true })).toBe(
|
|
"/api/invites/rule-stakeholder/verify?token=abc1234567©=1",
|
|
);
|
|
});
|
|
});
|