test: 添加完整测试套件(52 个文件,326 个用例)

基于 Vitest 搭建测试基础设施,覆盖后端纯函数、API 路由、
前端 hooks、UI 组件和页面级集成测试。
This commit is contained in:
2026-02-28 20:19:14 +08:00
parent 11eeec868e
commit 3ccd1262f9
59 changed files with 8131 additions and 3 deletions
+13
View File
@@ -0,0 +1,13 @@
import { vi } from "vitest";
import { mockDeep, mockReset, type DeepMockProxy } from "vitest-mock-extended";
import type { PrismaClient } from "@prisma/client";
export const prismaMock = mockDeep<PrismaClient>();
vi.mock("@/lib/prisma", () => ({
prisma: prismaMock,
}));
export function resetPrismaMock() {
mockReset(prismaMock);
}