feat(admin): ban appeals, photos polish, economy adjust, staff smoke
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
fe46bd0544
commit
3ad3f9512c
36 files changed
+1185
-293
No files matched your search
@@ -0,0 +1,85 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("staff smoke contract", () => {
|
||||
it("gates photos delete/bulk with PAGES_EDIT", () => {
|
||||
const src = readFileSync("src/actions/admin-photos.ts", "utf8");
|
||||
expect(src).toContain("PERMS.PAGES_EDIT");
|
||||
expect(src).toContain("deletePhoto");
|
||||
expect(src).toContain("bulkDeletePhotos");
|
||||
expect(src).toContain("logStaffActivity");
|
||||
expect(existsSync("src/app/admin/photos/page.tsx")).toBe(true);
|
||||
expect(readFileSync("src/app/admin/photos/page.tsx", "utf8")).toContain(
|
||||
"AdminPageShell",
|
||||
);
|
||||
});
|
||||
|
||||
it("gates bans create/lift", () => {
|
||||
expect(existsSync("src/app/admin/bans/page.tsx")).toBe(true);
|
||||
const bans = readFileSync("src/actions/admin-bans.ts", "utf8");
|
||||
expect(bans).toContain("liftBan");
|
||||
expect(bans).toContain("createBan");
|
||||
expect(readFileSync("src/app/admin/bans/page.tsx", "utf8")).toContain(
|
||||
"AdminPageShell",
|
||||
);
|
||||
});
|
||||
|
||||
it("wires ban appeal lift on help tickets", () => {
|
||||
const actions = readFileSync("src/actions/admin-help-tickets.ts", "utf8");
|
||||
expect(actions).toContain("liftBanFromHelpTicket");
|
||||
expect(actions).toContain("PERMS.USERS_BAN");
|
||||
const detail = readFileSync(
|
||||
"src/app/admin/help-tickets/[id]/admin-help-ticket-detail.tsx",
|
||||
"utf8",
|
||||
);
|
||||
expect(detail).toContain("liftBanFromHelpTicket");
|
||||
expect(detail).toContain("canLiftBan");
|
||||
});
|
||||
|
||||
it("exposes sanction timeline on user show", () => {
|
||||
expect(
|
||||
existsSync("src/app/admin/users/_components/user-sanction-timeline.tsx"),
|
||||
).toBe(true);
|
||||
expect(existsSync("src/app/admin/users/_lib/load-user-sanctions.ts")).toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
readFileSync("src/app/admin/users/show/[id]/page.tsx", "utf8"),
|
||||
).toContain("UserSanctionTimeline");
|
||||
});
|
||||
|
||||
it("ships shared ops + ticket queue helpers", () => {
|
||||
expect(existsSync("src/lib/admin/ops-health.ts")).toBe(true);
|
||||
expect(existsSync("src/lib/admin/ticket-queue-counts.ts")).toBe(true);
|
||||
expect(existsSync("src/lib/admin/ops-online-users.ts")).toBe(true);
|
||||
});
|
||||
|
||||
it("caches analytics via redisCache", () => {
|
||||
for (const path of [
|
||||
"src/app/admin/analytics/page.tsx",
|
||||
"src/app/admin/analytics/activity/page.tsx",
|
||||
"src/app/admin/analytics/economy/page.tsx",
|
||||
]) {
|
||||
expect(readFileSync(path, "utf8"), path).toContain("redisCache");
|
||||
}
|
||||
});
|
||||
|
||||
it("exports bulk adjust currency and trade lock", () => {
|
||||
const src = readFileSync("src/actions/bulk-users.ts", "utf8");
|
||||
expect(src).toContain("bulkAdjustCurrency");
|
||||
expect(src).toContain("setTradeLock");
|
||||
expect(src).toContain("tradeLockedUntil");
|
||||
});
|
||||
|
||||
it("guards dual ticket queues on admin and mod", () => {
|
||||
for (const path of [
|
||||
"src/app/admin/tickets/page.tsx",
|
||||
"src/app/admin/help-tickets/page.tsx",
|
||||
"src/app/mod/tickets/page.tsx",
|
||||
"src/app/mod/help-tickets/page.tsx",
|
||||
]) {
|
||||
expect(existsSync(path), path).toBe(true);
|
||||
expect(readFileSync(path, "utf8"), path).toContain("TicketQueueBanner");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user