Expired sign-in, save-progress, email-change, and invitation tokens (and any draft they carry) are cleared by a Cloudron scheduler task. Page timing logs record the path without the query string, and mail failures log a request id instead of an address.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { pathOnlyUrl } from "../../lib/server/pathOnlyUrl";
|
|
|
|
describe("pathOnlyUrl", () => {
|
|
it("drops the query string from an absolute URL", () => {
|
|
expect(
|
|
pathOnlyUrl(
|
|
"https://communityrule.info/api/auth/magic-link/verify?token=secret",
|
|
),
|
|
).toBe("https://communityrule.info/api/auth/magic-link/verify");
|
|
});
|
|
|
|
it("drops invite tokens and hashes", () => {
|
|
expect(
|
|
pathOnlyUrl(
|
|
"https://communityrule.info/api/invites/rule-stakeholder/verify?token=abc#frag",
|
|
),
|
|
).toBe(
|
|
"https://communityrule.info/api/invites/rule-stakeholder/verify",
|
|
);
|
|
});
|
|
|
|
it("keeps a share path with no query string", () => {
|
|
expect(pathOnlyUrl("https://communityrule.info/r/share-slug")).toBe(
|
|
"https://communityrule.info/r/share-slug",
|
|
);
|
|
});
|
|
|
|
it("strips a relative URL at the first ? or #", () => {
|
|
expect(pathOnlyUrl("/create/community-name?facet.size=small")).toBe(
|
|
"/create/community-name",
|
|
);
|
|
expect(pathOnlyUrl("/login#sent")).toBe("/login");
|
|
});
|
|
});
|