Files
EpicNext-Cms/src/lib/bans.test.ts
T
SimoandCursor 75cdfdebe4
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m36s
fix(admin): P0 integrity — permanent bans, ACL sidebar, rank guards
Co-authored-by: Cursor <[email protected]>
2026-07-22 19:01:59 +02:00

25 lines
678 B
TypeScript

import { describe, expect, it } from "vitest";
import { activeBanWhere, isBanActive } from "@/lib/bans";
describe("isBanActive", () => {
it("treats banExpire 0 as permanent", () => {
expect(isBanActive(0, 1_700_000_000)).toBe(true);
});
it("treats future expiry as active", () => {
expect(isBanActive(1_800_000_000, 1_700_000_000)).toBe(true);
});
it("treats past expiry as inactive", () => {
expect(isBanActive(1_600_000_000, 1_700_000_000)).toBe(false);
});
});
describe("activeBanWhere", () => {
it("includes permanent and future expires", () => {
expect(activeBanWhere(100)).toEqual({
OR: [{ banExpire: 0 }, { banExpire: { gt: 100 } }],
});
});
});