21 lines · 1.0 KB
import { describe, expect, test } from "bun:test";
import { disabledMessage, reachableWhileDisabled } from "./account-disable";

describe("disabled account notices", () => {
  test("disputes name the support address; other reasons are generic", () => {
    expect(disabledMessage("payment_dispute", "help@x.test")).toBe(
      "This account is disabled because of a payment dispute. Email help@x.test to resolve it.",
    );
    expect(disabledMessage("admin", "help@x.test")).toBe("This account is disabled. Email help@x.test to resolve it.");
    expect(disabledMessage("admin", null)).toBe("This account is disabled. Contact support to resolve it.");
  });

  test("only sign-out and the legal pages stay reachable", () => {
    expect(reachableWhileDisabled("/terms")).toBe(true);
    expect(reachableWhileDisabled("/logout")).toBe(true);
    expect(reachableWhileDisabled("/")).toBe(false);
    expect(reachableWhileDisabled("/settings")).toBe(false);
    expect(reachableWhileDisabled("/termsx")).toBe(false);
  });
});