lint: fix biome issues in new test files and helpers
CI / check (push) Failing after 34s
CI / preflight (push) Skipped
CI / deploy (push) Skipped

This commit is contained in:
openhands committed 2026-09-21 18:19:39 +02:00
1 parent 99eb3af17b
commit 93862c2275
41 files changed
+488 -314

No files matched your search

+18 -10
View File
@@ -1,7 +1,11 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
const state = vi.hoisted(() => ({
requirePermission: vi.fn(async () => ({ id: 100, rank: 7, username: "staff" })),
requirePermission: vi.fn(async () => ({
id: 100,
rank: 7,
username: "staff",
})),
revalidatePath: vi.fn(),
del: vi.fn(async () => [{ affectedRows: 1 }]),
update: vi.fn(async () => [{ affectedRows: 1 }]),
@@ -27,10 +31,12 @@ vi.mock("@/lib/services/rcon", () => ({ rcon: { send: state.rconSend } }));
vi.mock("@/lib/db", async () => {
const schema = await import("@/db/schema");
const { createFakeDb } = await import("@/test/fake-db");
const fake = createFakeDb((table: unknown, projection: Record<string, unknown>) => {
if (state.denied) throw new Error("not allowed");
return state.roomRows;
});
const fake = createFakeDb(
(_table: unknown, _projection: Record<string, unknown>) => {
if (state.denied) throw new Error("not allowed");
return state.roomRows;
},
);
return {
...schema,
db: {
@@ -92,9 +98,9 @@ describe("rooms actions", () => {
it("denies room edits without permission", async () => {
state.requirePermission.mockRejectedValueOnce(new Error("forbidden"));
await expect(
updateRoomItem({ roomId: 9, itemId: 4 }),
).rejects.toThrow("forbidden");
await expect(updateRoomItem({ roomId: 9, itemId: 4 })).rejects.toThrow(
"forbidden",
);
expect(state.update).not.toHaveBeenCalled();
});
@@ -114,7 +120,9 @@ describe("rooms actions", () => {
await bulkDeleteRoomItems({ roomId: 9, itemIds: [] });
expect(state.del).toHaveBeenCalledWith(Items, expect.anything());
expect(state.logStaffActivity).toHaveBeenCalledWith(
expect.objectContaining({ description: "Deleted 0 item(s) from room #9" }),
expect.objectContaining({
description: "Deleted 0 item(s) from room #9",
}),
);
expect(state.revalidatePath).toHaveBeenCalledWith("/admin/rooms/9/furni");
});
@@ -242,4 +250,4 @@ describe("rooms actions", () => {
await expect(updateRoom({ id: 9 })).rejects.toThrow("forbidden");
expect(state.update).not.toHaveBeenCalled();
});
});
});