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

+15 -14
View File
@@ -35,9 +35,15 @@ vi.mock("@/lib/services/site-settings", () => ({
}));
vi.mock("@/lib/logger", () => ({
logger: { error: mockLoggerError, warn: vi.fn(), info: vi.fn(), debug: vi.fn() },
logger: {
error: mockLoggerError,
warn: vi.fn(),
info: vi.fn(),
debug: vi.fn(),
},
}));
import { RadioBanners, RadioRanks, WebsiteSetting } from "@/lib/db";
import {
createRadioBanner,
createRadioRank,
@@ -48,11 +54,6 @@ import {
updateRadioBanner,
updateRadioRank,
} from "./admin-radio-extra";
import {
RadioBanners,
RadioRanks,
WebsiteSetting,
} from "@/lib/db";
function form(data: Record<string, string>): FormData {
const fd = new FormData();
@@ -158,7 +159,7 @@ describe("saveRadioSettings", () => {
});
it("logs and continues when the bulk upsert fails", async () => {
fakeDbConfig.fail = (kind: string) => (kind === "insert" ? true : false);
fakeDbConfig.fail = (kind: string) => kind === "insert";
await saveRadioSettings(form({ __keys: "radio_foo", radio_foo: "1" }));
expect(mockLoggerError).toHaveBeenCalledWith(
"Failed to bulk-save radio settings",
@@ -216,7 +217,7 @@ describe("createRadioBanner", () => {
});
it("logs and continues when the insert fails", async () => {
fakeDbConfig.fail = (kind: string) => (kind === "insert" ? true : false);
fakeDbConfig.fail = (kind: string) => kind === "insert";
await createRadioBanner(form({ imagePath: "/banners/c.png" }));
expect(mockLoggerError).toHaveBeenCalledWith(
"Failed to create radio banner",
@@ -266,7 +267,7 @@ describe("updateRadioBanner", () => {
});
it("logs and continues on update failure", async () => {
fakeDbConfig.fail = (kind: string) => (kind === "update" ? true : false);
fakeDbConfig.fail = (kind: string) => kind === "update";
await updateRadioBanner(form({ id: "3", imagePath: "/banners/x.png" }));
expect(mockLoggerError).toHaveBeenCalledWith(
"Failed to update radio banner",
@@ -292,7 +293,7 @@ describe("deleteRadioBanner", () => {
});
it("logs and continues on delete failure", async () => {
fakeDbConfig.fail = (kind: string) => (kind === "delete" ? true : false);
fakeDbConfig.fail = (kind: string) => kind === "delete";
await deleteRadioBanner(form({ id: "6" }));
expect(mockLoggerError).toHaveBeenCalledWith(
"Failed to delete radio banner",
@@ -339,7 +340,7 @@ describe("createRadioRank", () => {
});
it("logs and continues on insert failure", async () => {
fakeDbConfig.fail = (kind: string) => (kind === "insert" ? true : false);
fakeDbConfig.fail = (kind: string) => kind === "insert";
await createRadioRank(form({ name: "Broken" }));
expect(mockLoggerError).toHaveBeenCalledWith(
"Failed to create radio rank",
@@ -383,7 +384,7 @@ describe("updateRadioRank", () => {
});
it("logs and continues on update failure", async () => {
fakeDbConfig.fail = (kind: string) => (kind === "update" ? true : false);
fakeDbConfig.fail = (kind: string) => kind === "update";
await updateRadioRank(form({ id: "2", name: "VIP" }));
expect(mockLoggerError).toHaveBeenCalledWith(
"Failed to update radio rank",
@@ -409,7 +410,7 @@ describe("deleteRadioRank", () => {
});
it("logs and continues on delete failure", async () => {
fakeDbConfig.fail = (kind: string) => (kind === "delete" ? true : false);
fakeDbConfig.fail = (kind: string) => kind === "delete";
await deleteRadioRank(form({ id: "7" }));
expect(mockLoggerError).toHaveBeenCalledWith(
"Failed to delete radio rank",
@@ -417,4 +418,4 @@ describe("deleteRadioRank", () => {
);
expect(mockRevalidatePath).toHaveBeenCalledWith("/admin/radio/ranks");
});
});
});