chore(db): remove Prisma facade and drop prisma:generate from CI

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 14:38:42 +02:00
1 parent ca72966a37
commit 422567272c
17 files changed
+182 -1430

No files matched your search

+12 -5
View File
@@ -1,10 +1,19 @@
import { describe, expect, it, vi } from "vitest";
const findUnique = vi.hoisted(() => vi.fn());
const selectLimit = vi.hoisted(() => vi.fn().mockResolvedValue([]));
const mockFetch = vi.hoisted(() => vi.fn().mockResolvedValue({ ok: true }));
vi.mock("@/lib/prisma", () => ({
prisma: { websiteSetting: { findUnique } },
vi.mock("@/lib/db", () => ({
db: {
select: vi.fn(() => ({
from: vi.fn(() => ({
where: vi.fn(() => ({
limit: selectLimit,
})),
})),
})),
},
WebsiteSetting: { key: "key", value: "value" },
}));
vi.mock("@/env", () => ({
@@ -21,7 +30,6 @@ import { notify } from "./webhook";
describe("webhook", () => {
it("sends a Discord notification when webhook URL is configured", async () => {
findUnique.mockResolvedValue(null);
notify({
action: "ban",
actor: "admin",
@@ -41,7 +49,6 @@ describe("webhook", () => {
it("does not throw when fetch fails", async () => {
mockFetch.mockRejectedValueOnce(new Error("network error"));
findUnique.mockResolvedValue(null);
expect(() =>
notify({ action: "ban", actor: "admin", target: "user1" }),
).not.toThrow();