fix(admin): P0 integrity — permanent bans, ACL sidebar, rank guards
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
11004626c7
commit
75cdfdebe4
14 files changed
+458
-68
No files matched your search
@@ -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 } }],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user