Hold /privacy behind a flag until counsel reads it, and fix leftover legal and email copy.
This commit is contained in:
1 parent
ead6c8f716
commit
072e5362f5
43 files changed
+548
-191
No files matched your search
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user