Hold /privacy behind a flag until counsel reads it, and fix leftover legal and email copy.

This commit is contained in:
adilallo committed 2026-11-20 15:36:06 -07:00
1 parent ead6c8f716
commit 072e5362f5
43 files changed
+548 -191

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
import { afterEach, describe, expect, it } from "vitest";
import {
isPrivacyPolicyEnabled,
privacyPolicyUrl,
} from "../../lib/privacyPolicyEnabled";
const KEYS = ["ENABLE_PRIVACY_POLICY", "NEXT_PUBLIC_ENABLE_PRIVACY_POLICY"] 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("isPrivacyPolicyEnabled", () => {
it("is off unless a flag is the string true", () => {
delete process.env.ENABLE_PRIVACY_POLICY;
delete process.env.NEXT_PUBLIC_ENABLE_PRIVACY_POLICY;
expect(isPrivacyPolicyEnabled()).toBe(false);
expect(privacyPolicyUrl("https://communityrule.info")).toBeNull();
process.env.ENABLE_PRIVACY_POLICY = "yes";
expect(isPrivacyPolicyEnabled()).toBe(false);
process.env.ENABLE_PRIVACY_POLICY = "true";
expect(isPrivacyPolicyEnabled()).toBe(true);
expect(privacyPolicyUrl("https://communityrule.info/")).toBe(
"https://communityrule.info/privacy",
);
delete process.env.ENABLE_PRIVACY_POLICY;
process.env.NEXT_PUBLIC_ENABLE_PRIVACY_POLICY = "true";
expect(isPrivacyPolicyEnabled()).toBe(true);
});
});