Give finished Rules a print path, folded launch counts, and a two-day follow-up.
Export is PDF, RULE.md, and Print on US Letter, with every shared term, no member names, and a takeaway that points at Ask an organizer. Finished Rules keep type and place so the team can read folded counts without a database, Umami can sit beside the app with no cookies, and the person who holds the pen gets working PDF and RULE.md links 48 hours later.
This commit is contained in:
1 parent
0efc907633
commit
d9c475a967
74 files changed
+2401
-630
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { umamiTracker } from "../../lib/umami";
|
||||
|
||||
const KEYS = ["NEXT_PUBLIC_UMAMI_SRC", "NEXT_PUBLIC_UMAMI_WEBSITE_ID"] as const;
|
||||
const ORIGINAL = Object.fromEntries(
|
||||
KEYS.map((key) => [key, process.env[key]]),
|
||||
) as Record<(typeof KEYS)[number], string | undefined>;
|
||||
|
||||
afterEach(() => {
|
||||
for (const key of KEYS) {
|
||||
const original = ORIGINAL[key];
|
||||
if (original === undefined) delete process.env[key];
|
||||
else process.env[key] = original;
|
||||
}
|
||||
});
|
||||
|
||||
describe("umamiTracker", () => {
|
||||
it("is off when either env var is missing", () => {
|
||||
delete process.env.NEXT_PUBLIC_UMAMI_SRC;
|
||||
delete process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID;
|
||||
expect(umamiTracker()).toBeNull();
|
||||
process.env.NEXT_PUBLIC_UMAMI_SRC = "https://analytics.example.com/script.js";
|
||||
expect(umamiTracker()).toBeNull();
|
||||
});
|
||||
|
||||
it("returns the script URL and website id", () => {
|
||||
process.env.NEXT_PUBLIC_UMAMI_SRC =
|
||||
"https://analytics.example.com/script.js";
|
||||
process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID = "site-1";
|
||||
expect(umamiTracker()).toEqual({
|
||||
src: "https://analytics.example.com/script.js",
|
||||
websiteId: "site-1",
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects a non-http script URL", () => {
|
||||
process.env.NEXT_PUBLIC_UMAMI_SRC = "javascript:alert(1)";
|
||||
process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID = "site-1";
|
||||
expect(umamiTracker()).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user