fix(admin): P0 integrity — permanent bans, ACL sidebar, rank guards
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m36s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-22 19:01:59 +02:00
1 parent 11004626c7
commit 75cdfdebe4
14 files changed
+458 -68

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
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 } }],
});
});
});